Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Filter/search not working with column visibility until page refresh #864

Open
AlanKrygowski opened this issue Dec 29, 2018 · 0 comments
Open

Comments

@AlanKrygowski
Copy link

There seems to be an issue with using column filtering right after the column itself is appended using Column Visibility.

Steps to reproduce

  1. Open a table with not all (searchable) columns visible
  2. Show the column using the column visibility
  3. Try searching in the new column header

What happens?

Nothing :(
As if no listener was applied. After page reload, the input works as should.


Looking into it, the problem occurs due to usage of static binding in this file, lines 40 & 42: https://github.com/stwe/DatatablesBundle/blob/master/Resources/views/datatable/search.js.twig

The solution I found, was using dynamic bindings on the listeners:

$(selector).find("tr").on("keyup change", 'input.sg-datatables-individual-filtering', search);

$(selector).find("tr").on("keyup change", 'select.sg-datatables-individual-filtering', function(event) {...});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant