list.js icon indicating copy to clipboard operation
list.js copied to clipboard

How to reset?

Open Eikosa opened this issue 4 years ago • 4 comments

How can I update it in list.js after the table's content has changed with normal javascript? otherwise the previous list is coming back

Eikosa avatar Apr 14 '22 00:04 Eikosa

Use: .reIndex()

https://listjs.com/api/#reindex

lwmirkk avatar May 03 '22 18:05 lwmirkk

Note reIndex() builds from the visible HTML so if the list is currently filtered, the new index will only include the visible items. Not sure if this is the intended behavior...looking for a method to reIndex the full set while retaining the filter.

vanboom avatar Oct 05 '23 14:10 vanboom

Today I use in this way to re-index a list with items changed in "search in progress / filtered" as example: Filter the list as usual. When filter / search items in the list, I set a variable to search_in_progress = true. when remove an item with searchin progress / filter in progress: I clear the search, remove this item, reIndex and set the search / filter to the desired value again. This happens so fast the user not see the list update when clearing the filter / search, and the item is removed in the original desired position.

lwmirkk avatar Oct 05 '23 15:10 lwmirkk

@lwmirkk - yes, great idea. I was attempting to do this but had one logic twist that your suggestion helped to clarify. The list filter must be cleared prior to changing the DOM, then you can reindex and re-filter. It works - thank you!

vanboom avatar Oct 05 '23 16:10 vanboom