Search code examples
javascriptjqueryjquery-nestable

How to refresh (rebuild) tree in Nestable plugin?


I use Nestable2 plugin to create tree in my project.

I need to refresh (rebuild) tree when it was updated by ajax. I used next code. It create tree correctly but I can't change (move) depth (level). How to fix this problem?

$('.dd').nestable('init').nestable({maxDepth: 6}).nestable('collapseAll');

Solution

  • This code works for me:

    $('.dd').nestable('destroy');
    $('.dd').nestable({maxDepth: 6}).nestable('collapseAll');