PDA

View Full Version : Ext.tree.panel is not loading



kanthu509
25 Nov 2011, 1:23 AM
Hi,
I have a requirement where need to generate a tree from the server response.
Server response comes as JSONArray(Spring JSONArray) which contains root and child nodes.
Earlier have used TreePanel from Extjs3.x, it worked fine,
we migrated from Extjs3.x to Extjs4.x , now nothing is happening even server url is not hitting.

Tried using TreeStore but is not supporting JSONArray format, any help would be appriciated.

Please check the below code snippet for pannel definition.

var availsvcTree = Ext.create('Ext.tree.Panel',
{ id:'avail-tree-panel', width:280, height:250,
bodyStyle: 'background-color:white;',
frame: true,
folderSort:true,
loader: {
url:'/main/avail_tree.json' (http://www.sencha.com/forum/'/main/avail_tree.json')
},
autoScroll:true,
containerScroll: true,
root: {
text: 'Available Services',
id: 'source',
},
rootVisible: true
});

tobiu
25 Nov 2011, 1:42 AM
i would definitely go for the treeStore, since it offers a lot of additional goodies.

it should not be a big deal to convert your array into an object:



{success: true, data: myJSONarray}

kanthu509
28 Nov 2011, 5:20 AM
Hi,

Have tried using the TreeStore to load the data to the Ext.tree.Panel.

While page loading the page am getting ' record.isNode is noll or not an Object' from NodeInterface , after clicking the node getting internalId is null or not an object.

Spent lot of time to resolve but no luck any help would be appricitaed.If possible pls provide sample code

Below code is the part of the response coming from Server.

Actually this is JSONArrayFormat.


{"id":4,"text":"Region","leaf":false,"children":[{"id":2219,"text":"AFRICA","leaf":false,"children":[{"id":5,"text":"Territory","leaf":false,"children":[{"id":2058,"text":"ALGERIA","leaf":false,"children":[{"id":6,"text":"SubTerritory","leaf":true}]}]}]}]}