nextdigital
9 Dec 2009, 4:28 PM
If this is the wrong way to add nodes to an existing treegrid, then please close this bug and tell me how... This is the method I use for TreePanel so I figured it would be the same for TreeGrid.
Screenshots should tell the story.
Ext.onReady(function(){
var treegrid = new Ext.ux.tree.TreeGrid({
tbar: [{
text: 'Create Folder',
scope: this,
handler: function(){
var newNode = new Ext.tree.AsyncTreeNode({
errors:0,
text:"New Folder",
name:"New Folder",
recipients:0,
created:1260287731,
duplicates:0,
unsubscribed:0,
active:0,
iconCls:"icon-list",
bounced:0,
sent:0,
children: []
});
treegrid.getRootNode().appendChild(newNode);
}
}],
width: 500,
height: 300,
renderTo: Ext.getBody(),
enableDD: true,
columns:[{
id: 'name',
header: 'List Names',
width: 200,
sortable: true,
dataIndex: 'name'
},{
id: 'recipients',
header: 'Recipients',
width: 75,
sortable: true,
dataIndex: 'recipients'
},{
id: 'created',
header: 'Created',
width: 75,
sortable: true,
dataIndex: 'created'
},{
id: 'sent',
header: 'Sent',
width: 75,
sortable: true,
dataIndex: 'sent'
}]
});
var json = [{
"errors":0,
"leaf":true,
"name":"My List",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0
},{
"errors":0,
"name":"A Folder",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0,
"children": [{
"errors":0,
"leaf":true,
"name":"A child List",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0
}]
}]
var root = new Ext.tree.AsyncTreeNode({
text: 'Lists',
draggable: false,
children: json,
id: 'root'
});
treegrid.setRootNode(root);
});
Screenshots should tell the story.
Ext.onReady(function(){
var treegrid = new Ext.ux.tree.TreeGrid({
tbar: [{
text: 'Create Folder',
scope: this,
handler: function(){
var newNode = new Ext.tree.AsyncTreeNode({
errors:0,
text:"New Folder",
name:"New Folder",
recipients:0,
created:1260287731,
duplicates:0,
unsubscribed:0,
active:0,
iconCls:"icon-list",
bounced:0,
sent:0,
children: []
});
treegrid.getRootNode().appendChild(newNode);
}
}],
width: 500,
height: 300,
renderTo: Ext.getBody(),
enableDD: true,
columns:[{
id: 'name',
header: 'List Names',
width: 200,
sortable: true,
dataIndex: 'name'
},{
id: 'recipients',
header: 'Recipients',
width: 75,
sortable: true,
dataIndex: 'recipients'
},{
id: 'created',
header: 'Created',
width: 75,
sortable: true,
dataIndex: 'created'
},{
id: 'sent',
header: 'Sent',
width: 75,
sortable: true,
dataIndex: 'sent'
}]
});
var json = [{
"errors":0,
"leaf":true,
"name":"My List",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0
},{
"errors":0,
"name":"A Folder",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0,
"children": [{
"errors":0,
"leaf":true,
"name":"A child List",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0
}]
}]
var root = new Ext.tree.AsyncTreeNode({
text: 'Lists',
draggable: false,
children: json,
id: 'root'
});
treegrid.setRootNode(root);
});