Mercenaire
Mercenaire

Reputation: 206

The icon change after expand in Jstree

I have the icon from font awesome.

<li data-jstree='{"icon":"fa fa-envelope-o"}'>
    <span id="id">Description</span>
    <ul>
        <li data-jstree='{"disabled":true}'>
        <span id="id">Documents</span>
       </li> 
    </ul>
</li>

enter image description here

and when I open the node, the icon change to it's original state.

enter image description here

I have the problem with only 'fa fa-envelope-o', if I test with anoter like 'fa fa-envelope-open-o' it's work.

Thank you.

Upvotes: 2

Views: 287

Answers (1)

Mercenaire
Mercenaire

Reputation: 206

I found this solution, maybe there is a better way.

$('#TreeId').on("close_node.jstree", function (e,data) {    
    setTimeout(function(){
    $("#" + data.node.id).find('i').eq(1).removeClass('fa-minus-circle fa-plus-circle');        
    }, 1);
});

Upvotes: 2

Related Questions