Fancytree getSelectedNodes without using the select event
Asked Answered
A

2

7

I am using the fancytree plugin to render a directory and next to this fancytree is a button. The user is supposed to click this button, and I am supposed to get a list of selected nodes from the tree and do something with it.

How do I access the list of selected nodes from the tree in my button.click event?

$('#button').click(function() {
   // how to get selected nodes in tree
});
Almucantar answered 18/4, 2015 at 22:57 Comment(0)
B
-4
$('#button').click(function() {
     //first method - get previous element relative to the button
     $(this).prev().fancytree("getSelectedNodes");

     //second method - use array
     $("#tree").fancytree("getSelectedNodes");
});
Bugle answered 18/4, 2015 at 23:4 Comment(1)
I would add my +1 back if the above was fixed to work as shown in the followup post below.Kegler
M
35

The accepted answer gave me a "No such method" error. This worked:

$('#tree').fancytree('getTree').getSelectedNodes();
Mohammed answered 25/9, 2015 at 12:39 Comment(0)
B
-4
$('#button').click(function() {
     //first method - get previous element relative to the button
     $(this).prev().fancytree("getSelectedNodes");

     //second method - use array
     $("#tree").fancytree("getSelectedNodes");
});
Bugle answered 18/4, 2015 at 23:4 Comment(1)
I would add my +1 back if the above was fixed to work as shown in the followup post below.Kegler

© 2022 - 2024 — McMap. All rights reserved.