DataTables / SearchPanes

SearchPanes extension for DataTables
https://datatables.net
Other
19 stars 11 forks source link

Fix `clear pane` buttons not working after ajax reload #8

Closed lvmajor closed 4 years ago

lvmajor commented 4 years ago

When using searchPanes and table.ajax.reload(), the "clear pane" buttons available on each pane if the clear option is set to true, stops working as the event listeners are only set the first time the pane is displayed. This fix makes sure to reset the flag when rebuilding the pane so that the event listeners are re-attached as expected. (it's a one-liner fix at line 332)

The other changes are not mandatory, it's just to make sure there's no event listeners that are added twice or more as this was causing memory leaks and performance degradation in previous versions.

SandyDatatables commented 4 years ago

Hi @os1r1s110 ,

Thanks for the PR. There have been a lot of changes to SearchPanes since you made this PR (we've been busy!), apologies for that. There is often a constant stream of bugs coming in from the forum that we tend to address first. Take a look at the following example. It shows the clear pane button working after an ajax reload.

There have also been a lot of improvements to make sure that there are a minimal amount of event listeners being called, we've solved these with a slightly different approach to that which you have taken above.

I'm going to close this off based on the above.

Thanks, Sandy