Closed M-Mommsen closed 4 years ago
Hi @M-Mommsen , please be aware of the following rows visibility APIs:
All the above support a paginated table, there shouldn't be any need for additional callbacks or events.
Cheers
Hi @M-Mommsen , please be aware of the following rows visibility APIs:
- http://www.tablefilter.com/docs/class/src/tablefilter.js~TableFilter.html#instance-method-getVisibleColumnValues
- http://www.tablefilter.com/docs/class/src/tablefilter.js~TableFilter.html#instance-method-getVisibleColumnData
- http://www.tablefilter.com/docs/class/src/tablefilter.js~TableFilter.html#instance-method-isRowDisplayed
All the above support a paginated table, there shouldn't be any need for additional callbacks or events.
Cheers
Sorry, but after applying a filter, there are some "on_row_validated" events and one "on_after_filter" event. But in all the events with getVisibleColumnData(), I do NOT not get only the items visible on the page, but all items within the filter!
My workaround for now: Lazy loading checks start only after I receive a on_after_change_page event first. I start a timer of 1 second in on_after_filter, and then, I use getVisibleColumnData(). Furthermore I catch some more events like emitter->after-page-length-change
I don't know if there is an easier way, but at least, for now I am okay with this... it's just not pretty at all!
@M-Mommsen , right I see what you mean!
This example should kill your timer and simplify your workaround. When paging is on, that's the event you are looking for: grouped-by-page
:
https://codepen.io/koalyptus/pen/ZEboajz
Cheers
@M-Mommsen , right I see what you mean! This example should kill your timer and simplify your workaround. When paging is on, that's the event you are looking for:
grouped-by-page
: https://codepen.io/koalyptus/pen/ZEboajzCheers
Thanks it seems 'grouped-by-page' and 'on_after_change_page' callback give a working combination! This way on paging it's called twice, but that is okay for me!
You probably dont need on_after_change_page, grouped-by-page event as per above demo covers also page changes and column sorting.
You probably dont need on_after_change_page, grouped-by-page event as per above demo covers also page changes and column sorting.
The first "grouped-by-page event" did not contain any visible rows in my tests! So I needed some initial event.
The demo above does not need any 'initial event' and displays the visible column data at start-up.
When lazy loading of images is needed, there are no triggers to check which rows are currently visible after changing a filter! I am using a jquery filter like: tr[validrow="true"] img.lazy_load:visible But since the on_after_filter callback is triggered before applying the paginator, it would return all rows - of all pages!
Needed: Either fire on_before_change_page and on_after_change_page, or add a new callback like on_refreshed/on_change_visibility when a filter is changed and the paginator is applied! Or on_after_filter should be triggered later. Or another way to supply a function with a list of all actually visible rows