Hi,
I don't know why, but when I adjust the label converter like the example
with the icon converter, the removing works like expected.
Here the code:
http://tinyurl.com/278btvc
The main different is that I controller have no model on creation, I set
the model after the controller is configured completely.
Cheers,
Chris
Am 04.06.2010 19:47, schrieb Guilherme Aiolfi:
Hi,
take a look here (sorry for the length url, but none of the url
shortener was able to work with that url, they say it's invalid, but
works for me):
http://demo.qooxdoo.org/devel/playground/#%7B%22code%22%3A%20%22var%2520names%2520%253D%2520%255B%2522Max%2522%252C%2520%2522Jackob%2522%252C%2520%2522Tim%2522%252C%2520%2522Jack%2522%252C%2520%2522Dan%2522%252C%2520%2522Dustin%2522%252C%2520%2522Karl%2522%252C%2520%2522Jim%2522%255D%253B%250A%2520%2520%2520%2520%2520%2520var%2520emotes%2520%253D%2520%255B%2522embarrassed%2522%252C%2520%2522kiss%2522%252C%2520%2522plain%2522%252C%2520%2522sad%2522%252C%2520%2522surprise%2522%252C%2520%2522angel%2522%255D%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520data%250A%2520%2520%2520%2520%2520%2520var%2520rawData%2520%253D%2520%255B%255D%253B%250A%2520%2520%2520%2520%2520%2520for%2520(var%2520i%2520%253D%25200%253B%2520i%2520%253C%252020%253B%2520i%252B%252B)%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520var%2520person%2520%253D%2520%257B%257D%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520person.name%2520%253D%2520names%255Bi%2520%2525%2520names.length%255D%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520person.emote%2520%253D%2520emotes%255Bi%2520%2525%2520emotes.length%255D%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520person.online%2520%253D%2520(i%2520%2525%25203%2520%253D%253D%25200)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520rawData.push(person)%253B%250A%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520var%2520data%2520%253D%2520qx.data.marshal.Json.createModel(rawData)%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520widgets%250A%2520%2520%2520%2520%2520%2520var%2520list%2520%253D%2520new%2520qx.ui.form.List()%253B%250A%2520%2520%2520%2520%2520%2520list.setWidth(150)%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520add%2520the%2520widgets%2520to%2520the%2520document%250A%2520%2520%2520%2520%2520%2520this.getRoot().add(list%252C%2520%257Bleft%253A%252010%252C%2520top%253A%252080%257D)%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520options%2520for%2520the%2520icon%250A%2520%2520%2520%2520%2520%2520var%2520iconOptions%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520converter%253A%2520function(value)%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522icon%252F16%252Femotes%252Fface-%2522%2520%252B%2520value%2520%252B%2520%2522.png%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520controller%250A%2520%2520%2520%2520%2520%2520%252F%252F%25201.%2520Parameter%253A%2520The%2520data%2520as%2520a%2520qx.data.Array%250A%2520%2520%2520%2520%2520%2520%252F%252F%25202.%2520Parameter%253A%2520The%2520list%2520widget%250A%2520%2520%2520%2520%2520%2520%252F%252F%25203.%2520Parameter%253A%2520The%2520path%2520to%2520the%2520property%2520which%2520should%2520be%2520showed%2520in%2520the%2520label%250A%2520%2520%2520%2520%2520%2520var%2520controller%2520%253D%2520new%2520qx.data.controller.List(data%252C%2520list%252C%2520%2522name%2522)%253B%250A%2520%2520%2520%2520%2520%2520controller.setIconOptions(iconOptions)%253B%250A%2520%2520%2520%2520%2520%2520controller.setIconPath(%2522emote%2522)%253B%250A%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520options%2520for%2520the%2520online%2520binding%250A%2520%2520%2520%2520%2520%2520var%2520colorOptions%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520converter%2520%253A%2520function(data)%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520(data)%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522green%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%2520else%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522red%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520delegate%2520to%2520change%2520the%2520bindings%250A%2520%2520%2520%2520%2520%2520var%2520delegate%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520bindItem%2520%253A%2520function(controller%252C%2520item%252C%2520id)%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindDefaultProperties(item%252C%2520id)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25201.%2520Parameter%253A%2520The%2520property%2520chain%2520to%2520the%2520data%2520source%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25202.%2520Parameter%253A%2520the%2520property%2520name%2520to%2520in%2520the%2520target%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25203.%2520Parameter%253A%2520the%2520options%2520for%2520the%2520binding%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25204.%2520Parameter%253A%2520the%2520current%2520item%2520(comming%2520in%2520as%2520parameter)%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25205.%2520Parameter%253A%2520the%2520current%2520id%2520(comming%2520in%2520as%2520parameter)%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindProperty(%2522online%2522%252C%2520%2522textColor%2522%252C%2520colorOptions%252C%2520item%252C%2520id)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindProperty(null%252C%2520%2522label%2522%252C%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520converter%253A%2520function(data)%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522---%2522%2520%252B%2520data.getName()%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%252C%2520item%252C%2520id)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%2520%2520%2520%2520%2520%2520controller.setDelegate(delegate)%253B%250A%250A%250A%2520%2520%2520%2520%2520%2520var%2520removeButton%2520%253D%2520new%2520qx.ui.form.Button(%2522Remove%2522)%253B%250A%2520%2520%2520%2520%2520%2520removeButton.setWidth(120)%253B%250A%2520%2520%2520%2520%2520%2520this.getRoot().add(removeButton%252C%2520%257Bleft%253A%2520180%252C%2520top%253A%252080%257D)%253B%250A%2520%2520%2520%2520%2520%2520removeButton.addListener(%2522execute%2522%252C%2520function()%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520var%2520selected%2520%253D%2520controller.getSelection().getItem(0)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520var%2520model%2520%253D%2520controller.getModel()%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520controller.setModel(model.remove(selected))%253B%250A%2520%2520%2520%2520%2520%2520%257D%252C%2520this)%253B%250A%250A%250A%250A%250A%22%7D
<http://demo.qooxdoo.org/devel/playground/#%7B%22code%22%3A%20%22var%2520names%2520%253D%2520%255B%2522Max%2522%252C%2520%2522Jackob%2522%252C%2520%2522Tim%2522%252C%2520%2522Jack%2522%252C%2520%2522Dan%2522%252C%2520%2522Dustin%2522%252C%2520%2522Karl%2522%252C%2520%2522Jim%2522%255D%253B%250A%2520%2520%2520%2520%2520%2520var%2520emotes%2520%253D%2520%255B%2522embarrassed%2522%252C%2520%2522kiss%2522%252C%2520%2522plain%2522%252C%2520%2522sad%2522%252C%2520%2522surprise%2522%252C%2520%2522angel%2522%255D%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520data%250A%2520%2520%2520%2520%2520%2520var%2520rawData%2520%253D%2520%255B%255D%253B%250A%2520%2520%2520%2520%2520%2520for%2520%28var%2520i%2520%253D%25200%253B%2520i%2520%253C%252020%253B%2520i%252B%252B%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520var%2520person%2520%253D%2520%257B%257D%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520person.name%2520%253D%2520names%255Bi%2520%2525%2520names.length%255D%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520person.emote%2520%253D%2520emotes%255Bi%2520%2525%2520emotes.length%255D%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520person.online%2520%253D%2520%28i%2520%2525%25203%2520%253D%253D%25200%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520rawData.push%28person%29%253B%250A%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520var%2520data%2520%253D%2520qx.data.marshal.Json.createModel%28rawData%29%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520widgets%250A%2520%2520%2520%2520%2520%2520var%2520list%2520%253D%2520new%2520qx.ui.form.List%28%29%253B%250A%2520%2520%2520%2520%2520%2520list.setWidth%28150%29%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520add%2520the%2520widgets%2520to%2520the%2520document%250A%2520%2520%2520%2520%2520%2520this.getRoot%28%29.add%28list%252C%2520%257Bleft%253A%252010%252C%2520top%253A%252080%257D%29%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520options%2520for%2520the%2520icon%250A%2520%2520%2520%2520%2520%2520var%2520iconOptions%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520converter%253A%2520function%28value%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522icon%252F16%252Femotes%252Fface-%2522%2520%252B%2520value%2520%252B%2520%2522.png%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520controller%250A%2520%2520%2520%2520%2520%2520%252F%252F%25201.%2520Parameter%253A%2520The%2520data%2520as%2520a%2520qx.data.Array%250A%2520%2520%2520%2520%2520%2520%252F%252F%25202.%2520Parameter%253A%2520The%2520list%2520widget%250A%2520%2520%2520%2520%2520%2520%252F%252F%25203.%2520Parameter%253A%2520The%2520path%2520to%2520the%2520property%2520which%2520should%2520be%2520showed%2520in%2520the%2520label%250A%2520%2520%2520%2520%2520%2520var%2520controller%2520%253D%2520new%2520qx.data.controller.List%28data%252C%2520list%252C%2520%2522name%2522%29%253B%250A%2520%2520%2520%2520%2520%2520controller.setIconOptions%28iconOptions%29%253B%250A%2520%2520%2520%2520%2520%2520controller.setIconPath%28%2522emote%2522%29%253B%250A%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520options%2520for%2520the%2520online%2520binding%250A%2520%2520%2520%2520%2520%2520var%2520colorOptions%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520converter%2520%253A%2520function%28data%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520%28data%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522green%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%2520else%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522red%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%250A%2520%2520%2520%2520%2520%2520%252F%252F%2520create%2520the%2520delegate%2520to%2520change%2520the%2520bindings%250A%2520%2520%2520%2520%2520%2520var%2520delegate%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520bindItem%2520%253A%2520function%28controller%252C%2520item%252C%2520id%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindDefaultProperties%28item%252C%2520id%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25201.%2520Parameter%253A%2520The%2520property%2520chain%2520to%2520the%2520data%2520source%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25202.%2520Parameter%253A%2520the%2520property%2520name%2520to%2520in%2520the%2520target%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25203.%2520Parameter%253A%2520the%2520options%2520for%2520the%2520binding%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25204.%2520Parameter%253A%2520the%2520current%2520item%2520%28comming%2520in%2520as%2520parameter%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252F%252F%25205.%2520Parameter%253A%2520the%2520current%2520id%2520%28comming%2520in%2520as%2520parameter%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindProperty%28%2522online%2522%252C%2520%2522textColor%2522%252C%2520colorOptions%252C%2520item%252C%2520id%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindProperty%28null%252C%2520%2522label%2522%252C%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520converter%253A%2520function%28data%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520%2522---%2522%2520%252B%2520data.getName%28%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%252C%2520item%252C%2520id%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%2520%2520%2520%2520%2520%2520controller.setDelegate%28delegate%29%253B%250A%250A%250A%2520%2520%2520%2520%2520%2520var%2520removeButton%2520%253D%2520new%2520qx.ui.form.Button%28%2522Remove%2522%29%253B%250A%2520%2520%2520%2520%2520%2520removeButton.setWidth%28120%29%253B%250A%2520%2520%2520%2520%2520%2520this.getRoot%28%29.add%28removeButton%252C%2520%257Bleft%253A%2520180%252C%2520top%253A%252080%257D%29%253B%250A%2520%2520%2520%2520%2520%2520removeButton.addListener%28%2522execute%2522%252C%2520function%28%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520var%2520selected%2520%253D%2520controller.getSelection%28%29.getItem%280%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520var%2520model%2520%253D%2520controller.getModel%28%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520controller.setModel%28model.remove%28selected%29%29%253B%250A%2520%2520%2520%2520%2520%2520%257D%252C%2520this%29%253B%250A%250A%250A%250A%250A%22%7D>
What to do?
1. Select "--- Tim";
2. Click in "Remove"
What is wrong?
All items above the item removed have its label changed, seems that it
ignores that code:
*controller**.**bindProperty**(**null**, **"label"**, **{**
** **converter**: **function**(**data**)**
** **{**
** **return **"---" **+ **data**.**getName**(**)**;**
** **}**
** **}**, **item**, **id**)**;*
Am I doing something wrong or it's a bug?
--
Christian Hagendorn
Software Entwickler
1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver
Mauss, Gert Nowotny, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel