How to Get Selected Jstree Root

Asked

Viewed 199 times

1

Galley,

good afternoon,

a doubt,

I’m using the Jstree and I need some help.

When I select the child nodes :Arvore

I can get them through the script :

$('#arvore').jstree(true).get_selected().

But I can’t get the "Parents" nodes (the ones with Squared).

There is a way to return all selected, children and parents?

Thank you

1 answer

1


I got,

If someone needs these "square" nodes are called . jstree-Undetermined.

To catch them is enough :

    var checked_ids = [];
    $("#arvore").find(".jstree-undetermined").each(
          function (i, element) {
              var nodeId = $(element).closest('.jstree-node').attr("id");
              checked_ids.push(nodeId);
          }
      );

Browser other questions tagged

You are not signed in. Login or sign up in order to post.