koalyptus / HTML-Table-Filter-Generator

Filter HTML tables data easily
http://tablefilter.free.fr
19 stars 12 forks source link

on_before_filter, on_after_filter both called after filtering #3

Closed yohanrodriguez closed 9 years ago

yohanrodriguez commented 9 years ago

I'm trying to call a custom function before and after filtering but on_before_filter and on_after_filter are both called after filtering...

koalyptus commented 9 years ago

Just checked the code and those callbacks are fired before and after filtering (https://github.com/koalyptus/HTML-Table-Filter-Generator/blob/master/TableFilter/tablefilter_all.js). What makes you think they are both fired after filtering?

yohanrodriguez commented 9 years ago

I've made a console.log("on_before_filter") and console.log("on_after_filter") and they are both displayed after filtering. Maybe my table is too big ?


De : koalyptus notifications@github.com Envoyé : lundi 9 février 2015 11:19 À : koalyptus/HTML-Table-Filter-Generator Cc : RODRIGUEZ Yohan Objet : Re: [HTML-Table-Filter-Generator] on_before_filter, on_after_filter both called after filtering (#3)

Just checked the code and those callbacks are fired before and after filtering (https://github.com/koalyptus/HTML-Table-Filter-Generator/blob/master/TableFilter/tablefilter_all.js). What makes you think they are both fired after filtering?

Reply to this email directly or view it on GitHubhttps://github.com/koalyptus/HTML-Table-Filter-Generator/issues/3#issuecomment-73485618.

koalyptus commented 9 years ago

Try an alert and check if 'on_before_filter' alert shows up before the filtering.

yohanrodriguez commented 9 years ago

With an alert, 'on_before' is fired before filtering but after 'on_after' the table is still not ready...


De : koalyptus notifications@github.com Envoyé : lundi 9 février 2015 11:44 À : koalyptus/HTML-Table-Filter-Generator Cc : RODRIGUEZ Yohan Objet : Re: [HTML-Table-Filter-Generator] on_before_filter, on_after_filter both called after filtering (#3)

Try an alert` and check if 'on_before_filter' alert happens before the filtering.

Reply to this email directly or view it on GitHubhttps://github.com/koalyptus/HTML-Table-Filter-Generator/issues/3#issuecomment-73488860.

koalyptus commented 9 years ago

yeah depending on your configuration some other things could happen after, like re-calculating pages for pagination, re-apply alternating rows etc etc. But the on_after_filter callback will already return you the TF instance with an updated state in terms of properties relevant to the filtering process (filtetered, visible, hidden rows collections etc).