EasyUI Forum
May 19, 2024, 05:45:42 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Expand/Colapse iconCls for Tree  (Read 8780 times)
iceh
Jr. Member
**
Posts: 61


View Profile
« 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.
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #1 on: January 07, 2014, 06:46:20 AM »

Any idea on this one?

Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 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>
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #3 on: January 08, 2014, 02:20:30 AM »

OK cool looks simple.

I use the node's attributes for the storage of the icons.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!