Extjs 4 nested xml into treepanel

yenilmez86

New Member
I have a java webservice I can't modify. It produce xml like :\[code\]<query> <entity TYPE="Location"> <value TYPE="Id"/> <value TYPE="Class"/> <value TYPE="Name"/> </entity> <entity TYPE="Activity"> <value TYPE="Id"/> <value TYPE="Date"/> <value TYPE="Duration"/> </entity></query>\[/code\]I need to put the xml into the treestore, entities will be folder and values as leafs. I tried to describe 2 models with relations :\[code\]Ext.define( 'modelEntity' , { extend : 'Ext.data.Model' , proxy: { type: 'ajax', url: 'query.xml', //just for tests reader: { type: 'xml' , root: 'query' , record: 'entity' } , }, fields: [ { name: 'leaf' , type: 'boolean', defaultValue: true} , { name: 'text' , type: 'string', mapping: '@TYPE'} ], hasMany: { model: "modelValue", name: "value", }});Ext.define( 'modelValue' , { extend : 'Ext.data.Model' , fields: [ { name: 'leaf' , type: 'boolean', defaultValue: true} , { name: 'text' , type: 'string', mapping: '@TYPE'} ], belongsTo: "modelEntity"});\[/code\]with one treestore and a treepanel :\[code\]Ext.define('storeQuery' , { extend: 'Ext.data.TreeStore', model: 'modelEntity', root: { expanded: true, leaf: false, children: [] }, autoLoad: false});Ext.create('Ext.tree.Panel', { store: Ext.create('storeQuery'), rootVisible: false ......});\[/code\]Obviously it doesn't work, only entities are displayed, their children nodes aren't. Help me please ! =)
 
Back
Top