Disable JSTREE

Just wondering if there is any way in JSTREE to disable the checkbox?

I basically need to disable (not deselect) all my selected child nodes when I click on the parent node.

+3


source to share


1 answer


For this you need to create a new type (disabled). This can be done as follows:

   "types" : {
        "types": {
        "disabled" : { 
              "check_node" : false, 
              "uncheck_node" : false 
            } 
        }
    }

      

and then assign this type as

.set_type("disabled", "#node5");

      



More documentation here.

To disable all child nodes, create an event handler for the change_state event

$("#treeElement").bind("change_state.jstree", function (e, d) {
    var node = d.args[0];
    // here disable all child nodes
    }
});

      

+3


source







All Articles