Hey,
just check out the following API doc:
http://demo.qooxdoo.org/current/apiviewer/#qx.data.marshal.IMarshalerDelegate~getModelClass
We also have a section about that in the manual as well:
http://manual.qooxdoo.org/current/pages/data_binding/models.html#how-to-get-my-own-code-into-the-model
There is even a demo which shows something similar:
http://demo.qooxdoo.org/devel/demobrowser/index.html#data~OwnCodeInModel.html
Regards,
Martin


Am 29.07.2013 um 17:37 schrieb Stefan Freundel 
<[email protected]<mailto:[email protected]>>:


Hi Martin,

thanks for the quick reply. Unfortunately, I still have a lack of understanding.

I've tried to create a custom model for the JSON file but the qooxdoo 
documentation
does not provide a hint how to do it. I'm totally lost ... It seems the 
information, I'm
looking for is available but I don't know how to access it.


test container model ({$$hash:"177-0", $$user_name:"Test Suites", 
$$user_children:{$$hash:"433-0", __nD:[{$$hash:"434-0", $$user_name:"Customer", 
$$user_children:{$$hash:"435-0", __nD:[{$$hash:"436-0", $$user_name:"ESC10", 
$$user_option:"-X0 -Xsize-opt", $$user_desc:"Test description contains details 
regarding the purpose of the test", 
__cK:{'idBubble-435-0':["changeBubble|bubble|899"]}}, {$$hash:"437-0", 
$$user_name:"ESP03", $$user_option:"-X0 -Xsize-opt", $$user_desc:"Test 
description contains details regarding the purpose of the test", 
__cK:{'idBubble-435-0':["changeBubble|bubble|900"]}}, {$$hash:"438-0", 
$$user_name:"Star 2", $$user_option:"-X0 -Xsize-opt", $$user_desc:"Test 
description contains details regarding the purpose of the test", 
__cK:{'idBubble-435-0':["changeBubble|bubble|901"]}}], length:3, 
$$user_autoDisposeItems:true, 
__cK:{'idBubble-434-0':["changeBubble|bubble|902"]}}, 
__cK:{'idBubble-433-0':["changeBubble|bubble|903"], 'idBubble-439-0':null, 
'idBubble-202-0':["changeBubble|bubble|908"]}}], length:1, 
$$user_autoDisposeItems:true, 
__cK:{'idBubble-177-0':["changeBubble|bubble|904"]}}, 
__cK:{'idBubble-202-0':["changeBubble|bubble|907"]}})


Thanks in advance

Stefan






Gesendet: Montag, 29. Juli 2013 um 08:29 Uhr
Von: "Martin Wittemann" 
<[email protected]<mailto:[email protected]>>
An: "qooxdoo Development" 
<[email protected]<mailto:[email protected]>>
Betreff: Re: [qooxdoo-devel] JSON - getItem
Hello Stefan,
> first of all congratulation to QooxDoo 3.0 - great job !

Thanks. :)

> I'm using a JSON file with the following structure.
>
> {
> "name": "Test Suites",
> "children": [
> {
> "name": "Customer",
> "children": [
> {
> "name": "ESC10",
> "option": "-X0 -t",
> "desc": "Test description contains details regarding the
> purpose of the test"
> }
> ]
> }
> ]
> }
>
> The details are show in a Virtual.Tree.
> // **********************************************************************
> // loads the tree model
> // **********************************************************************
> var url = "json/tests.json";
> var store = new qx.data.store.Json(url);
> var dataModel = store.getModel();
> this.__store = store;
> // connect the store and the tree
> store.bind("model", abc_test, "model");
>
> This works !!! Now the question.
> I would like to access fields like "name", "option" and "desc".
> Using
> var itemModel = data[0].getModel().getName();
> var name = itemModel.getValue();
> works nice, but I can't access the other fields ...

Well, I guess you can if they are available. But as your structure shows, the 
other fields seem to be optional and therefore, not available on every model 
item. This means that the accessor-methods won't be available on every item as 
well. So you have a bunch of options:
1. use duck-typing to check if any accessor is available
2. use a custom model class for every item which will hold null values for you
3. change the data to contain the fields with null values

Regards,
Martin
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to