I'm using jsTree with the checkbox plugin. I have the cascade set to "down". This works great, except that when I want to load data with a mixture of checked and unchecked nodes, the cascade overrides the "state" setting for nodes. E.g.
var data = [
{"id":"p90","parent":"#","text":"Page1", "state": { "selected": true} },
{"id":"p100","parent":"p90","text":"Page2", "state": { "selected": true} },
{"id":"p101","parent":"p100","text":"Page3", "state": { "selected": false} },
{"id":"p102","parent":"p101","text":"Page4", "state": { "selected": true} },
{"id":"p103","parent":"p101","text":"Page5", "state": { "selected": false} }
];
$(function () {
$("#PageTree")
.jstree({
core: { data: data },
plugins: ["checkbox"],
checkbox: { cascade: "down", three_state: false },
expand_selected_onload: true
});
});
This results in this:
But it should look like this:
I tried setting the "cascade" setting after the tree is loaded, but that didn't work. It seems like the only option will be to write my own cascade code, but I'm looking for a slicker option.
forget_state
and it caused me a lot of trouble...