Results 1 to 3 of 3

Thread: treestore / model override isLeaf implementation

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    NL
    Posts
    608
    Vote Rating
    1
      0  

    Default treestore / model override isLeaf implementation

    How can i override the isLeaf() implementation? This is my model

    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'));
    	}
    });
    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?

    Thanks

  2. #2
    Sencha Premium Member
    Join Date
    Dec 2011
    Location
    London, UK
    Posts
    269
    Vote Rating
    14
      0  

    Default

    Good question. Did you ever work out how to have the isLeaf function return an appropriate value?

  3. #3
    Sencha Premium Member
    Join Date
    Dec 2011
    Location
    London, UK
    Posts
    269
    Vote Rating
    14
      0  

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •