PDA

View Full Version : Could not bind Tree with TreeStore



viral_lss
21 Mar 2012, 1:55 AM
Hello,

I am creating web application using .Net Framework.( I am new for using ExtJS4)
To bind tree, created below Tree.js

var treestore = Ext.create('Ext.data.TreeStore', {

proxy: {
type: 'ajax',
headers: { 'Content-Type': 'application/json; charset=UTF-8' },
url: '/EZProcessDataProvider.aspx/GetDataForTreeViewFromDatabase',
extraParams: { level: '0', id: '0', nodePath: '' },
reader: {
type: 'json',
root: 'd'
}
}

});

var tree = Ext.create('Ext.tree.Panel', {
store: treestore,
rootVisible: false,
renderTo: 'tree',
width: 200,
height: 250
});

After run this script in aspx page, there is no data display in TreePanel.

In FireBug, It shows GET request and Response.

Response Looks as :

{"d":{"Data":[{"id":"1","Level":1,"LableText":"1","text":"1(1254)","icon":"/images/icon/level_1.ico","leaf":false,"children":[]}]}}

Why TreeStore not binded to tree? what causing problem?

Thanks

Romick
21 Mar 2012, 7:57 AM
Response should look like this:


{
"success":true,
"d":[{
"id":"1",
"Level":1,
"LableText":"1",
"text":"1(1254)",
"icon":"/images/icon/level_1.ico",
"leaf":false,
"children":[]
}]
}