PDA

View Full Version : How show nested xml data into a tree?



tjhons
23 Jan 2012, 2:59 AM
Hi!
I want to create TreePanel with data model loaded from xml. In docs i find fine examples how to do it with simple structured xml, but not found what doing my case.
I have next nested xml data structure:


<officeGroup>
<name>office name 1</name>
<child>
<officeGroup>
<name>office name 1.1</name>
<employee>
<person>
<displayName>name 1</displayName>
</person>
</employee>
<child>
<officeGroup>
<name>office name 1.1.1</name>
<employee>
<person>
<displayName>name 1</displayName>
</person>
<person>
<displayName>name 2</displayName>
</person>
</employee>
</officeGroup>
<officeGroup>
<name>office name 1.1.2</name>
<employee>
<person>
<displayName>name 1</displayName>
</person>
<person>
<displayName>name 2</displayName>
</person>
</employee>
</officeGroup>
</child>
</child>
</officeGroup>
<officeGroup>
<name>office group 2</name>
<employee>
<person>
<displayName>name 1</displayName>
</person>
<person>
<displayName>name 2</displayName>
</person>
</employee>
</officeGroup>

One office group may have several children office groups.
What to do in this case?

mitchellsimoens
23 Jan 2012, 12:13 PM
You will need to capture this and turn it into something the store can use.

tjhons
24 Jan 2012, 6:04 AM
mitchellsimoens,

I receive this xml from ajax response from server.
I find Ext.data.reader.Xml useful for it, but i have not found examples how use it when xml have deeply nested tags.

tjhons
25 Jan 2012, 5:02 AM
up

tjhons
27 Jan 2012, 1:59 AM
I solve it by rewriting my xml format as in example and changing server side.