Skip to content Skip to sidebar Skip to footer

How To Load Jstree Checkbox On Load VB ASP

I'm trying to load jstree checkboxes on load using ASP. The code behind takes a tree node and populates a list item for the jstree to use. In this process, there are nodes that are

Solution 1:

It is not the li element where you should add jstree-clicked class (I see it in this line: li.Attributes.Add("class", "jstree-clicked") ) but the a element inside that li.

Make sure you set that class for an immediate a child of the li.


Solution 2:

In the javascript file, the jsTree then checks for the attribute and preselects the check box once everything has been loaded. This appropriately selects the check box. As mentioned in the comment above, this avoids only handling the CSS but rather handles the entire node.

$("#myTreeNode").bind('ready.jstree', function (event, data) {
    var $tree = $(this);
    $($tree.jstree().get_json($tree, {
        flat: true
    })).each(function () {
    var checked = $(this).attr('rel');
    var node;
    if( checked == "true"){
        node = $("#myTreeNode").jstree().select_node(this.id);
    }
});
});

Post a Comment for "How To Load Jstree Checkbox On Load VB ASP"