Hi Herman, On Tuesday April 5 2011 14:13:45 hgc2002 wrote: > I'm moving from qx.ui.form.List to qx.ui.list.List. In form.List you can > use ListItem to render the item. > In list.List you are tied to qx.data.Array but all available examples works > with simple strings as the items for the list. > > What happen if I want to render the item with an icon like with ListItem? > How can I do that? You can create your data (e.g. JSON) and use the JSON marshaler to create a model out of your JSON data and use this to feed the list as model data.
To be able to let the list show the right values you can use the "setLabelPath" and "setIconPath" methods to point the list to the right model data to use for showing the label and the icon. This little example shows the use of it: http://tinyurl.com/69yzd3g Hope this helps you further. Regards, Alex > > Here is the example available in the Demo (a valid example): > > // Creates the model data > var rawData = []; > for (var i = 0; i < 8; i++) { > rawData.push(i); > } > var data = new qx.data.Array(rawData); > > // Creates the list. > var list = new qx.ui.list.List(data); > > But what happen if the data is little bit more complex? See this example: > > for (var i = 0; i < 8; i++) { > rawData.push({ > id : i, > name : "something " + i, > value : Math.random() > }); > } > var data = new qx.data.Array(rawData); > > or this: > > for (var i = 0; i < 8; i++) { > rawData.push(new myClass(i); > } > var data = new qx.data.Array(rawData); > > With this last case I got the following error message: > "Invalid incoming value for property 'label' of class 'qx.ui.basic.Atom': > Expected value to be a string but found myClass[...]" > > I think that myClass should follow an Interface or Mixin in order to be > rendered by the list, but I can't find any information. > > Thanks for your help! > > Regards, > Herman ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
