I have a tree structure using jsTree, like this:
<div id="SampleContainer">
<ul>
<li>
Top 1
<ul>
<li>
Sub 1
<ul>
<li>
A
</li>
<li>
B
</li>
</ul>
</li>
<li>
Sub 2
<ul>
<li>
A
</li>
<li>
B
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
I would like to put icons of font-awesome for the check-box:
I tried by doing this:
$(document).ready(function(){
$("#SampleContainer").jstree({
"plugins": ["checkbox"],
core: {
"themes": {
"icons": false,
"responsive": true
}
}
});
$('#SampleContainer').on('ready.jstree click', function (e, data) {
$('a > i.jstree-checkbox').removeClass('jstree-icon jstree-checkbox').addClass('fa fa-square-o');
$('a > i.jstree-clicked').removeClass('jstree-icon jstree-checkbox').addClass('fa fa-check-square');
});
});
and this icon 'fa fa-square-o' is coming. not able see the onclick 'fa fa-check-square'.!
Does anyone have an idea about this issue?
I added a new
toggleCheckClasses
function that adds / removes the rightfa
classes depending on the state of the checkbox. And I attached this function to the tree nodes in yourtreejs-ready
/click
handler.EDIT : I added the toggling of children elements classes