EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: varonica on December 24, 2012, 08:02:46 AM



Title: Level in combotree !!
Post by: varonica on December 24, 2012, 08:02:46 AM
Hi sir, Is there a way to get level of combotree ?? I just found 'getLevel' but it available only in treegrid.
Code:
   var nodes = $('#test').treegrid('getLevel', node.code);
Please help me!! i really need ur help !!!!  :'( :'( :'(


Title: Re: Level in combotree !!
Post by: stworthy on December 25, 2012, 01:31:20 AM
Extend a new method called 'getLevel' for tree, just like this.
Code:
	<script>
$.extend($.fn.tree.methods,{
getLevel: function(jq, target){
return $(target).find('span.tree-indent,span.tree-hit').length;
}
});
</script>

Now, rewrite your code as below:
Code:
var level = $('#test').combotree('tree').tree('getLevel', node.target);
alert(level);


Title: Re: Level in combotree !!
Post by: varonica on December 25, 2012, 07:58:53 PM
Thanks sir, i really appreciate ur help. But it's not working instead of alert '0' all the times. Please, help me sir :'( :'( :'(


Title: Re: Level in combotree !!
Post by: stworthy on December 25, 2012, 08:22:16 PM
Please refer to this sample http://jsfiddle.net/w2bVT/.


Title: Re: Level in combotree !!
Post by: varonica on December 25, 2012, 08:48:11 PM
Thanksssssssssssssssssssssssssssssssssssssssssssssssssss!!! You saved me!You're a genius!!   :o :o :o :o :o :o 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)
Really thanks sir :'(