PDA

View Full Version : Problem with appendChild method of treeview



url
25 Sep 2013, 5:55 AM
Hi All,

I have a treepanel to which i'm dynamically adding nodes.

I have the following data

var obj = {
name:'types',
children:[{
name:'string',
leaf:true
},{
name:'float',
leaf:true
},{
name:'integer',
leaf:false,
children:[{
name:'longint',
leaf:true
},{
name:'shortint',
leaf:true
}]
}]
}

Ext.ComponentQuery.query('treepanel')[0].getRootNode().appendChild(obj);

As per my above node structure first node should be 'types' and under 'types' first child should be 'string'.

But in my view the first node is displaying as 'types' and under 'types' first child is added as 'integer', nd then other nodes.

Can anybody tell me what is the problem?

Regards
URL

ettavolt
27 Sep 2013, 11:22 AM
By default (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.TreeStore-cfg-folderSort) 'folders' are sorted above 'leaves'.