PDA

View Full Version : Nested list with XML



slalu
26 May 2011, 10:35 AM
I try to build a menu with a Nested List populated by an XML file, but I didn’t find a way to set the “leaf” and "card" properties at true for some entries.

Someone has an idea how to proceed?



Ext.regModel('modelMenu', {
fields: [
{name: 'text', type: 'string'},
{name: 'card'},
{name: 'source', type: 'string'},
{name: 'model', type: 'string'}
]
});

App.stores.Menu = new Ext.data.TreeStore({
model: 'modelMenu',
autoLoad:true,
proxy: {
type: 'ajax',
url : 'menu.xml',
reader: {
type : 'xml',
root: 'menu',
record: 'item'
}
}
});


XML:


<?xml version="1.0" encoding="UTF-8"?>
<menu>
<item>
<text>Outils</text>
<model>Title</model>
</item>
<item>
<text>Signaler presence</text>
<card>Apps.views.IdentifyUser</card>
<model>Clickable</model>
<leaf>true</leaf>
</item>
</menu>


Thanks