Вопрос

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()]));
}
});
Это было полезно?

Решение

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

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top