Frage

Can you please tell me how to make node become selectable (add active class) automatically? When user select any node it become selectable, in other word it become blue. But now when I click by child button i got the child of "b", but it is not selectable. Can we make "b" selectable? When a user clicks on "child button", can we move this active class by using next and previous button? It goes to top and bottom when user click next and previous button. http://jsfiddle.net/fuu94/44/

$('#child').click(function () {
for(i in $('#tree').jstree(true).get_node('b').children){    alert($('#tree').jstree(true).get_text($('#tree').jstree(true).get_node('b').children[i.toString()]));
}
});
War es hilfreich?

Lösung

To set unset active on next and pre click:

  $('#next').click(function () {
    if($('.jstree-clicked').closest('li').next().length)
        $('.jstree-clicked').removeClass('jstree-clicked').closest('li').next().find('a:eq(0)').addClass('jstree-clicked')
  });
  $('#pre').click(function () {
     if($('.jstree-clicked').closest('li').prev().length)
        $('.jstree-clicked').removeClass('jstree-clicked').closest('li').prev().find('a:eq(0)').addClass('jstree-clicked')
  });

Demo

Andere Tipps

You can make 'b' selectable by using select_node(node). http://jsfiddle.net/23NAG$('#tree').jstree(true) .select_node('b'); from http://www.jstree.com/docs/interaction/

The next and previous can use the same select_node using the child ids.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top