EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: iceh on December 23, 2013, 12:38:11 AM



Title: Expand/Colapse iconCls for Tree
Post by: iceh on December 23, 2013, 12:38:11 AM
Hi,

how do I add an iconCls dependent on the expand/collapse state to a Tree Item?

I just found the iconCls in the documentation.


Title: Re: Expand/Colapse iconCls for Tree
Post by: iceh on January 07, 2014, 06:46:20 AM
Any idea on this one?



Title: Re: Expand/Colapse iconCls for Tree
Post by: stworthy on January 07, 2014, 05:49:02 PM
When collapse or expand a node,  you can call 'update' method to update the iconCls for this node.
Code:
<ul class="easyui-tree" data-options="
data:data,animate:true,
onBeforeExpand:function(node){
$(this).tree('update',{
target:node.target,
iconCls:'icon-e'
});
},
onBeforeCollapse:function(node){
$(this).tree('update',{
target:node.target,
iconCls:'icon-c'
});
}"></ul>


Title: Re: Expand/Colapse iconCls for Tree
Post by: iceh on January 08, 2014, 02:20:30 AM
OK cool looks simple.

I use the node's attributes for the storage of the icons.