EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: vinod on October 25, 2012, 06:50:06 AM



Title: Expand the node when using setValues function
Post by: vinod on October 25, 2012, 06:50:06 AM
I need help in expanding the node while using the function setValues.

example:
   
Folder1
    File1
    Folder2
        File2
        Folder3
            File31
            File32


In the above example if I am passing the node-id of the child "file32" to the function setValues. Then the nodes "Folder2", "Folder3" should automatically be expanded.

I am using the following code.
 <script>
 $(document).ready(function () {
     $('#cc').combotree('setValues', 1,2,20,40,10);   
});
</script>



Title: Re: Expand the node when using setValues function
Post by: stworthy on October 25, 2012, 05:53:33 PM
Call 'expandTo' method of tree to expand all the parent nodes of specify node. Please try the following code:
Code:
var c = $('#cc');
c.combotree('setValue','file32');
var t = c.combotree('tree');  // get tree object
var node = t.tree('find', 'file32');  // find the specify node
t.tree('expandTo', node.target);