How To Get Root Selected Jstree

1

Galera,

Good afternoon,

A Doubt,

I'm using JsTree and I need some help.

When I select child nodes:

I can get the same through the script:

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

But I can not get the "Parent" nodes (the ones with Square).

Is there a way to return all selected children and parents?

Thank you

    
asked by anonymous 05.05.2017 / 19:59

1 answer

1

I got it,

If anyone needs these "square" nodes, they are called .jstree-undetermined.

To get them, just:

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