EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: mzeddd on October 03, 2012, 08:57:49 AM



Title: Is it possible to make Tree item 'selected' by any HTML
Post by: mzeddd on October 03, 2012, 08:57:49 AM
Hi,

I would like to have "Item 1" 'selected' like I just clicked on it when I load the page. After that I could select any other item I like.
It could be smth like 'selected' flag for 'option' tag in 'select' or ...
Code:
<ul class="easyui-tree">
   <li>Item 1</li>
   <li>Item 2</li>
   <li>Item 3</li>
</ul>

Thanks in advance,
Valery



Title: Re: Is it possible to make Tree item 'selected' by any HTML
Post by: stworthy on October 04, 2012, 06:11:32 AM
The 'selected' option is not available now, but calling 'select' method can do the same thing. The code looks like this:

Code:
<ul class="easyui-tree" data-options="
onLoadSuccess:function(){
var node = $(this).tree('find','i1');
$(this).tree('select', node.target);
}
">
<li id="i1">Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>