Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
This repository was 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

Description

@AlanKrygowski

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) {...});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions