-
23 Jun 2011 7:24 AM #1
treestore / model override isLeaf implementation
treestore / model override isLeaf implementation
How can i override the isLeaf() implementation? This is my model
but the isLeaf function is never called.. I can't change the server side response. How can i map fieldvalues from my server side response into the defaults node fields?Code:Ext.define('Item', { extend: 'Ext.data.Model', fields: [ 'name', 'itemCode', 'url', 'siteURL', 'category', 'client', {name:'userName', mapping:'user > userName', type:'string'} ], isLeaf:function(){ return Ext.isEmpty(this.get('category')) && Ext.isEmpty(this.get('userName')); } });
Thanks
-
11 Mar 2012 9:07 AM #2
Good question. Did you ever work out how to have the isLeaf function return an appropriate value?
-
11 Mar 2012 11:01 AM #3
Figured it out for my scenario. It was necessary to make sure the JSON response includes an appropriate boolean value for a 'leaf' property and to make sure the model definition for the 'leaf' field is marked as boolean. Then, for me at least, the model's isLeaf() function then just worked.


Reply With Quote