PDA

View Full Version : urgent help required - tree store



deepakpoda2000
11 Oct 2012, 10:05 PM
I have a tree panel - and when am expanding the folder, the whole tree is displayed(from the root) instead of its sub folders

please let me know what has to be changed - below is my code

var store1 = Ext.create('Ext.data.TreeStore', {
autoLoad: false,
proxy: {
type: 'ajax',
url: 'tree_servlet',
reader: {
type: 'json'
},
writer: {
type: 'json'
}
},
root: {
text: 'Root Directory',
expanded: true
}
});

var tree = Ext.create('Ext.tree.Panel', {
store: store1,
hideHeaders: true,
rootVisible: true,
id: 'details-panel',
viewConfig: {
plugins: [{
ptype: 'treeviewdragdrop'
}]
},
height: 450,
width: 500,
title: 'Directory Listing',
renderTo: 'tree',
collapsible: true,
listeners: {
'render': function(tp){
var el = Ext.getCmp('details-panel').getStore();
}
},
dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'Save',
handler: function(){
}
}]
}]
});

vietits
11 Oct 2012, 11:00 PM
It seems that your server script always returns the whole tree instead of returning only the sub-tree. Your server script should return only the sub-tree basing on the node id that is sent with param 'node'.

deepakpoda2000
11 Oct 2012, 11:10 PM
right.. but on the expand of a folder - how do I pass the node id?

for the first time tree is loaded, param 'root' is sent to server..
same way, on expand of a folder, folder id/name is not sent... what should I configure in the store/panel?

vietits
11 Oct 2012, 11:18 PM
right.. but on the expand of a folder - how do I pass the node id?

for the first time tree is loaded, param 'root' is sent to server..
same way, on expand of a folder, folder id/name is not sent... what should I configure in the store/panel?
param 'node' which contains id of loading node will be sent automatically by framework.

deepakpoda2000
12 Oct 2012, 12:00 AM
yeah.. you are right..
am able to get the param @ server side.. now I can send out whatever is required

thanks a lot for your quick response