PDA

View Full Version : How to represent this data in models



glafrance
14 Sep 2012, 10:14 AM
The following XML data has <child> nodes that contain other <child> nodes.

How would I represent this data using models? There could be many levels of nested <child> nodes, and each of them could themselves have child nodes.



<child>
<accountId>339</accountId>
<child>
<accountId>884</accountId>
<id>88366645</id>
<name>Test Account One</name>
<parentId>1042868</parentId>
</child>
<hasChildCompanies>true</hasChildCompanies>
<id>1042868</id>
<name>Test Account</name>
<parentId>1020</parentId>
</child>

scottmartin
14 Sep 2012, 12:27 PM
Have a look at the following for nested data:
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.reader.Reader

You can also map a field : { name : 'field', mapping: 'parent.child' }

Scott.