zorab47 / active_admin-sortable_tree

Show ActiveAdmin index as a nested tree with drag'n'drop
MIT License
162 stars 127 forks source link

Lazy load #46

Closed sazor closed 8 years ago

sazor commented 9 years ago

Hi. First of all I would like to thank you for this gem, it saves me a lot of time. But I faced problem of huge amount of items (~7400 with complex structure). So I think that lazy load with start_collapsed: true is only reliable solution. Are you planning on implementing this feature? I'm going to try it myself but it will be very useful to read your opinion.

zorab47 commented 9 years ago

Neat idea. I see your initial implementation in #47. I think this could be a useful feature to add to the gem; even more so in a situation like you describe with thousands of records.

There may be some strange situations when items are sorted if they aren't all present on the page. Have you noticed any issues when moving items across tree levels or resorting items in the list?

Also, having tests would be a big help to verify the functionality.

sazor commented 9 years ago

I've tested moving and resorting and haven't detected any issues with it. But my implementation with ObjectSpace seems to be unstable. Sometimes ObjectSpace.each_object(ActiveAdmin::Views::IndexAsSortable) returns empty array. But on next click everything is ok. So sometimes it takes two clicks to expand list. I'm currently working on rewriting this part of code. I need build_nested_item method from ActiveAdmin::Views::IndexAsSortable object but Arbre doesn't let me initialize instance properly... I'll add tests as soon as I can. But for now rewriting ObjectSpace part of code is the most important goal.

zorab47 commented 8 years ago

Closed due to inactivity. Please reopen if you want to continue with this addition.

ghost commented 7 years ago

+1 In my app > 10000 categories

Zmokizmoghi commented 7 years ago

2k records and index page loads 4 seconds, any updates on this issue?

sazor commented 7 years ago

I could try make it right way from scratch if you're interested.

zorab47 commented 7 years ago

I'm open to adding the ability to lazy load the hierarchy. What would your new approach be @sazor?