I creating simple tree with rest service on Extjs 4.1.
How can I change parentId property name from Ext.data.NodeInterface
?
Here is my model:
Ext.define('Buildlife.model.Folder', {
extend:'Ext.data.Model', idProperty:'id',
fields:[
{name:'id', type:'auto',defaultValue:null},
{name:'name', type:'auto'},
{name:'files',type:'auto',convert:function(val,rec){
for(var i in val){
var each = val[i];
Ext.apply(each,{
name: each.fileName,
leaf:true,
iconCls:'x-event-icon'
});
rec.appendChild(rec.createNode(each));
}
return val;
},defaultValue:null}
],
proxy:{
type:'rest',
url:GlobalConf.contextPath+'/rest/folder',
reader:{type:'json', root:'children', successProperty:'success'},
writer:{type:'json', root:'children', writeAllFields:false},
listeners:{exception:GlobalConf.storeExceptionHandler}
}
});
When I add child node, it send parent node as a parentId.
{
"children": {
"name": "test",
"parentId": "4fc742f344aeac0cc87e6afa",
"leaf ": false
//etc.
}
}
Is it possible to change it to customProperty such as:
{
"children": {
"name": "test",
"customProperty": "4fc742f344aeac0cc87e6afa",
"leaf ": false
//etc.
}
}