View Full Version : Converting Nested List Demo to read XML?

13 Sep 2011, 3:57 AM
I am trying to convert the Nested List Component Demo to read XML rather than JSON. Here is the original demo:

Intro to the Nested List Component
code: https://github.com/senchalearn/Nested-list-demo
demo: http://www.sencha.com/learn/intro-to-the-nested-list-component/

I've created a small xml file called tracks.xml to use instead of tracks.json.

<text>B.B. King</text>
<text>Live at County Jail</text>
<info>Live in Cook County Jail is a 1971 live album by B.B. King recorded in Cook County Jail, Chicago, Illinois. It was ranked as number 499 in the book version of Rolling Stone's 500 Greatest Albums of All Time.</info>
<info>hello leaf</info>

I've modified the data store to use the xml reader:

NestedListDemo.music_store = new Ext.data.TreeStore({ model: 'ListItem',
proxy: {
type: 'ajax',
url: 'data/tracks.xml',
reader: {
type : 'xml',
root : 'items',
model : 'ListItem',
record : 'items'

Now when I run the demo, it displays the first item's text node - "Blues" - but when I click on that node, it animates but still displays the first item's text node - "Blues".

Can anyone tell me what I need to do to make this work?

14 Nov 2011, 2:36 PM
There's a really smooth XML and AJAX based nested list demo on www.iphoneaccordionmenu.com (http://www.iphoneaccordionmenu.com) but I'm not sure how they've managed to code the nested list component.