PDA

View Full Version : How can i set leaf true for all nodes of a tree grid which do not have children



pk.hafeez
19 Feb 2012, 10:17 PM
Hi,

Im working with ext js 4.0 tree grid. Right now i have my grid totally expanded i mean bottom most child nodes are also expanding again to show the parent tree chain again. Right now the json data im constructing server side. At server side, i find difficult to set leaf true as ther is much logic. Can i do it at client side. Please refer the code. and give me any renderer code to be added if any could solve my problem.

mitchellsimoens
20 Feb 2012, 5:27 AM
You can hack into the TreeStore and reader. Best place is to do it on the server side.

sskow200
20 Feb 2012, 1:27 PM
by overriding the onNodeAdded function in Ext.data.TreeStore....



Ext.create('Ext.data.TreeStore', {
onNodeAdded: function(parent, node){
node.leaf = true;
this.callParent(arguments);
}
});