1

Note: I have already read the following threads:

I have a multilevel jstree with multiple sibling parent nodes and several children under each parent node.

Whenever any node gets checked/unchecked, I want to receive the list of all checked nodes. I did this using the following method:

$("#jstree-picker").on("check_node.jstree uncheck_node.jstree", function (event, data) {
    console.log(data.selected);
});

When I check/uncheck any of the leaf nodes (lowest-level children), the above code prints out the list of all selected nodes correctly. However, when I check/uncheck a parent node, all its children get checked/unchecked correctly, but they do not show up in the list of selected nodes!

1man
  • 5,216
  • 7
  • 42
  • 56

1 Answers1

1

I just found the solution. "selected" and "checked" are different things. I don't know exactly what selected does, but checked is what I was looking for.

$("#jstree-picker").on("check_node.jstree uncheck_node.jstree", function (event, data) {
    console.log($("#jstree-picker").jstree(true).get_checked());
});
1man
  • 5,216
  • 7
  • 42
  • 56