View Full Version : How to verify the selected node is leaf node of tree

20 Dec 2012, 11:08 PM
How to verify the leaf node of the tree if someone selecting the leaf node? Since select event returns four parameter (this,record,index,eOpts),record is Ext.data.Model, but there is no function for verifying the leaf node. Even in Ext.tree.Panel don't have the function for verifying the leafe node.

I want to verify that the selected node is leaf node.

Any help will be much appreciated.


21 Dec 2012, 12:24 AM



check the nodeInterface http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface

21 Dec 2012, 1:11 AM
Hi tvanzoelen,

Thanks for quick reply.
record.isLeaf() is working fine. But I don't understand , in this scenario record is the model instance. But in Ext.data.Model don't have any method isLeaf(). How do i find this isLeaf() method of NodeInterface should apply on
record. I am not able to understand that. How to identify the relation between the Model and NodeInterface. In the docs there is nothing mentioned in Model that all the methods of NodeInterface can be apply on model instance.

Please help me understand the docs provided by extjs group.


21 Dec 2012, 1:15 AM
If you configured you tree properly the model used in the tree is a TreeModel


See that the NodeInterface is in the required section. The TreeModel is decorated with methods of the nodeInterface.

And if not there is always the leaf property in the record.data part.

21 Dec 2012, 1:41 AM
Thanks tvanzoelen, to make me understand how it works. I am using Ext.data.Model but still it's working.

I have one more issue, please help me on that,
My issue is that , I want to restrict entering more than 1000 character in htmleditor. The character can be anything may be it's html tag , white space etc.I want to validate the htmleditor for that , if the entered character is more than 1000 than the htmleditor field should be validation fail and it will show the red color border on the field. It just similar like maxNumer : 1000 in textarea or textfield.

Can you please help me out in this?