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]>
An: "qooxdoo Development" <[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 = ""> > 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]
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

Reply via email to