ExtJS Tree panel binding
Iam design A ExtJS Combo with TreePanel
How to bind treePanel from Database(Please provide any sample code) How to give ur开发者_高级运维l to treepanel and how to set as parent and child...
Thanks in advance
Here is a simple tree:
var tree= new Ext.tree.TreePanel({
renderTo: Ext.getBody(),
height: 300,
useArrows: true,
animate: true,
border: false,
root: {
nodeType: 'async',
text: 'Gallery',
draggable: false,
id: '0'
},
loader: {
url: '/Url to your server side for getting your tree data',
requestMethod: 'GET'
},
});
You need to code your server side to return your tree data as json. Here is an example:
[
{id:'1',text:'First Data',leaf:true},
{id:'2',text:'Second Data',leaf:true}
]
If you need to change or set the URL using APIs, you can do it like this:
treeObject.getLoader().url = "/Your new Url to server side";
Majority of the time we load new nodes through an URL. There is no specific APIs for creating a parent or child. Can you explain what you are trying to do?
精彩评论