Hi,

qx.data.marshal.Json.createModel is the right way. Normally it is not 
necessary to create instances from dynamically created classes. The JSON 
store uses the same marshaler implementation. Therefore the same 
dynamically created class should be used with the marshaler and the JSON 
store.

Have a look at the tree demo [1]. I use the JSON store to load the tree 
and the "Update Model" button creates items with the marshaler. Both 
uses the same dynamically created class, because the object structure of 
a leaf is the same.

But I don't know why the sorting doesn't work. Could you please post 
your sort function?

Cheers,
Chris


Am 23.04.2011 12:39, schrieb tizio85:
> Hi,
> I'm using data binding in my apllication. I used the qx.data.store.Json
> class to fetch a PHP script that outputs JSON encoded data. The data are
> correctly gotten, infact I can use it with success. Further I can see with
> the debugger that it creates a class in qx.data.model. Since the structure
> of the data is made of:
>
> -id field (a number)
> -text (string)
> -time (float)
>
> the class that gets created is qx.data.model.id"text"time, written exatly in
> this way (I don't know if " is one double quote or two single quote) because
> both the debug method and firebug DOM inspector write it in this way, so I
> think it's the name qooxdoo gave to that class.
>
> Now, I have a qx.data.Array of objects of that class (as a property of the
> model property of the JSON store), how can I do if I want do add a new
> object of that type tho the array?
> How can I create an instance of qx.data.model.id"text"time from code?
> First, it's tennically possible?
> If yes, how can I do?
>
> Because, obviously, writing
>
> var o = new qx.data.model.id"text"time();
>
> gives me error caused by quotes, also escaping them with \.
>
> I saw in the documentation that the data binding mechanism use this piece of
> code to internally set property changes:
>
> targetObject["set" + qx.lang.String.firstUp(targetProperty)](data);
>
> I have to use something similar? I tried something similar but doesn't work,
> I don't know how to write it.
>
> I read somewhere about using qx.data.marshal.Json.createModel, but I tried
> this and seems like that the models created with it and ones with JSON store
> are not EXATLY made of the same internal structure, because the sort()
> method of Array works bad (it doesn't sort all elements, exatly when in the
> array are present both JSON store created models and json marshal created
> models).
>
> --
> View this message in context: 
> http://qooxdoo.678.n2.nabble.com/how-to-use-dinamically-created-class-tp6299292p6299292.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been
> demonstrated beyond question. Learn why your peers are replacing JEE
> containers with lightweight application servers - and what you can gain
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to