Closed nurzhannogerbek closed 6 years ago
@NogerbekNurzhan can you try for test replace this line:
$('.dd').nestable({maxDepth: 6}).nestable('collapseAll');
with this:
$('.dd').nestable('destroy');
$('.dd').nestable({maxDepth: 6}).nestable('collapseAll');
Can you compare in Google Developer Tool (Network tab), the difference between ajax call and when you call it by ?page=2
? It looks like ajax call has some problems, it returning elements in wrong order. In your case, I will also suggest using JSON format instant of building HTML structure, then you can use functions like:
$('.dd').nestable('add', {"id":1,"children":[{"id":4}]});
to add new elements from the second page.
I tried your code but it didn't help me. I think problem with Waypoints plugin. So I decided to use other library which work with Nestable2 correctly but with some problems. I close this topic. Thank you for advice about JSON by the way! :)
First of all THANK YOU for this wonderful library! :)
I use Nestable2 to render the tree in my Django project. There are a lot of data in tree so I decided to use infinity scrolling by Waypoints plugin. I have next problem.
Let me explain it by example. I have next tree structure in database:
Thats what happens in browser:
As you can see second part which was load by ajax (Waypoints plugin) show second part of tree incorrect. Can someone say how to fix this problem please?! It seems like I need refresh Nestable2, isn't it? Cause DOM changed...
P.S. If I set in url
?page=2
is show me second part correctly by the way.document_content.html:
documents.html:
tree_view_template.html:
js: