I create TreeGrid in Tab Panel:
Code:
var store=new Ext.ux.maximgb.treegrid.AdjacencyListStore({
autoLoad: true
,leaf_field_name: 'leaf'
,parent_id_field_name: 'parentid'
,url: config.url
,reader: new Ext.data.JsonReader(
{
root: 'root'
,totalProperty: 'total_count'
,id: 'id'
,successProperty: 'success'
}
,['title', {name:'id',type:'int'}, {name:'parentid',type:'int'}, 'dtcreate', 'countchilds', {name:'leaf',type:'bool'}]
)
});
var grid=new Ext.ux.maximgb.treegrid.GridPanel({
id:pid
,stripeRows: true
,title:t
,store:store
,master_column_id:'title'
,autoExpandColumn:'title'
,columns:[
{id:'title',header:'title',align:'left',width:200,sortable:true,dataIndex:'title'}
,{id:'id',header:'id',align:'left',width:60,sortable:true,dataIndex:'id'}
,{header:'parentid',align:'left',width:60,sortable:true,dataIndex:'parentid'}
,{header:'dtcreate',align:'left',width:120,sortable:true,dataIndex:'dtcreate'}
,{header:'countchilds',align:'left',width:50,sortable:true,dataIndex:'countchilds'}
]
,root_title: t
,bbar: new Ext.ux.maximgb.treegrid.PagingToolbar({
store: store
,displayInfo: true
,pageSize: 10
})
});
this.mainPanel.add(
grid
).show();
Then send JSON data:
1.
Code:
{"root":[{"id":"1000000","title":"BD","parentid":"0","dtcreate":"2007-01-22 00:00:00","countchilds":"16","leaf":false}],"success":true,"total_count":1}
2.
Code:
{"root":[{"id":"200000","title":"CP","parentid":"1000000","dtcreate":"2007-01-22 00:00:00","countchilds":"4","leaf":false},{"id":"300000","title":"New","parentid":"1000000","dtcreate":"2007-06-25 11:08:10","countchilds":"3","leaf":false},{"id":"4000062","title":"Main","parentid":"1000000","dtcreate":"2007-08-31 12:41:09","countchilds":"12","leaf":false},{"id":"4000063","title":null,"parentid":"1000000","dtcreate":"2007-08-31 12:43:45","countchilds":"57","leaf":false},{"id":"4000433","title":null,"parentid":"1000000","dtcreate":"2008-01-11 00:06:43","countchilds":"57","leaf":false},{"id":"4000773","title":null,"parentid":"1000000","dtcreate":"2008-02-15 11:39:27","countchilds":"0","leaf":true},{"id":"4000778","title":null,"parentid":"1000000","dtcreate":"2008-02-15 12:01:30","countchilds":"0","leaf":true},{"id":"4000779","title":null,"parentid":"1000000","dtcreate":"2008-02-15 12:02:09","countchilds":"0","leaf":true},{"id":"4000780","title":"Access","parentid":"1000000","dtcreate":"2008-02-15 12:02:43","countchilds":"0","leaf":true},{"id":"4000781","title":"Research","parentid":"1000000","dtcreate":"2008-02-15 12:12:28","countchilds":"0","leaf":true}],"success":true,"total_count":16}
3.
Code:
{"root":[{"id":"202000","title":"Users","parentid":"200000","dtcreate":"2007-01-22 00:00:00","countchilds":"3","leaf":false},{"id":"205000","title":null,"parentid":"200000","dtcreate":"2007-04-11 20:45:06","countchilds":"3","leaf":false},{"id":"206000","title":"All documents","parentid":"200000","dtcreate":"2007-01-22 00:00:00","countchilds":"0","leaf":true},{"id":"400000","title":null,"parentid":"200000","dtcreate":"2007-01-22 00:00:00","countchilds":"37","leaf":false}],"success":true,"total_count":4}
All works, but childs adds to end of tree, not into parent node....what i do wrong?