Hi Herman,
On Wednesday April 6 2011 07:18:40 hgc2002 wrote:
> My items do not exist before creating the list, so using
>
> var data = qx.data.marshal.Json.createModel(rawData);
>
> is not possible when rawData is empty (obvious because what model can you
> create from null?!)
It is no problem at all to create the model afterwards and establish the
binding later on. Just pass "null" to the "qx.ui.list.List" widget for the
model.
> Using qx.data.Array gives that possibility (after all, it just creates an
> internal empty array).
>
> But here is the deal: combining your example with the qx.data.Array option
> I get the following error:
>
> "qx.core.AssertionError: error" in SingleValueBinding.js:545
>
> I'm using list.setLabelPath("label") and my objects are constructed using:
>
> rawData.push({
> label : "" + Math.random()
> });
If you want to use object literals as data you have to make sure that the
model you pass to the widget consists of qooxdoo objects. One additional step
is necessary here:
--snip--
var model = qx.data.marshal.Json.createModel(rawData);
--snip--
> I've tried also doing this in my class:
>
> properties :
> {
> label : {
> init : null,
> check : "String"
> }
> }
>
> Then using it to fill the array:
>
> var item = new myClass();
> item.setLabel("" + Math.random());
> rawData.push(item);
In the above example you have to provide change events for each property you
want to bind. Then it works.
> So, the original problem remain: qx.ui.list.List cannot be used with (not
> so or so) complex objects...
I've created a second playground demo which shows the use of an own class with
data binding using the "qx.ui.list.List" widget to prove it is working :)
http://tinyurl.com/4yjuco8
This example also works with setting the model afterwards and does add some
icon option converter to display the icon based on boolean property.
Additionally you can look at the following examples:
http://demo.qooxdoo.org/1.4/demobrowser/#virtual~List.html
http://demo.qooxdoo.org/1.4/demobrowser/#virtual~ExtendedList.html
http://demo.qooxdoo.org/1.4/demobrowser/#virtual~SettingsList.html
and at the documentation at
http://manual.qooxdoo.org/1.4/pages/widget/virtuallist.html
to get more information about the use of the "qx.ui.list.List" widget.
If you have any further questions, don't hesitate to ask.
Regards,
Alex
------------------------------------------------------------------------------
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