PDA

View Full Version : Problem with adding node in a treePanel



iNes14
13 Jan 2012, 2:40 AM
Hello everybody :)

I want to add actioncolumn in a treegrid (based on this example (http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/tree/treegrid.html)) which allows to add nodes.

I have follow a post (http://www.sencha.com/forum/showthread.php?144872-Insert-New-Node-in-Tree) to do that.

So I have :



handler:function(){
var Document = store.getRootNode();
var insertedNode = Document.appendChild("New node");
Document.data.leaf = false;
}



where store


Ext.define('Request', {
extend: 'Ext.data.Model',
fields: [
{name: 'request',type: 'string'}
]
});

var store = Ext.create('Ext.data.TreeStore', {
model: 'Request',
proxy: {
type: 'ajax',
url: 'treegrid.json'
},
folderSort: true,
id: 'source'
});


I got the error modelClass is undefined.

Can someone help me ? Thank you...

iNes14
13 Jan 2012, 6:59 AM
I found the origin of this problem :

I was done :


Document.appendChild('New Child');


Indeed of doing that :


Document.appendChild({leaf: true,request: 'New Child'});