SearchPanes and search plugins
SearchPanes and search plugins
I'm working on a search plugin to filter duplicate data from the visible rows. If I use the search input I see that the plugin is executed once for each visible row when using draw(). However if I use SearchPanes to filter the table then the plugin is executed once for each row, visible or not, in the table when using draw().
Is this expected behavior with SearchPanes?
Is there a way in the search plugin to know if the row is visible so I know with to ignore it or use it when checking for duplicates? Or a way to know Search Panes performed the draw to skip the plugin altogether?
Do you want a test case?
Kevin
This question has accepted answers - jump to:
Answers
I'm not sure tbh, this is one for @sandy . I've raised it, so it doesn't get forgotten (DD-1379 for my reference) - and he'll reply back when next in.
Ta,
Colin
Hi Kevin,
Yes please for the test case, I think it may help me to see exactly what is happening
I will try and take a look tomorrow for you.
Thanks,
Sandy
Here is the test case:
http://live.datatables.net/wenaxuti/6/edit
I added a console.log statement to the search plug. Test steps:
londonin the search inputTechnical Authorcheckboxsearch plugin13 timesLondonin the SearchPaneTechnical Authorcheckboxsearch plugin57 timesAs a side note I'm changing the way I'm handling removing duplicates. Not due to this behavior but its just a better solution. Just letting you know that I'm not relying on anything from this thread for my project.
Kevin
Hi Kevin,
If you take a look at this block of code then you will see the following...
_fnFilter()is the Datatables searching filter, this is run before any custom filters that have been added.fnFilterCustom()is where any custom filters added are being run.SearchPanes pushes onto the custom filter array as well as your custom filter. So for your above test steps when you are searching for
londonfirst of all there are only 13 rows to check when it comes to selectingTechnical Author. However when you selectLondonin the SearchPanes then this initial filter has not run yet, so all of the rows will be check by the custom filter.Hope this clears things up,
Sandy
Thanks. Figured there was a good reason for it.
Kevin