Hide all rows by default, show rows on search

Hide all rows by default, show rows on search

nwnw Posts: 1Questions: 1Answers: 0

Hi All,

I'm looking to reverse the functionality of the search. I want all rows hidden by default, and then when a search term is entered, matching rows become visible.

Is this possible or will I have to write some jQuery to complete this?


  • allanallan Posts: 61,044Questions: 1Answers: 9,955 Site admin

    DataTables' "search" is technically a filter rather than a search, since it removes items from a lost based on the input.

    Two options spring to mind though:

    1. Hide the table is there is no search term applied, or
    2. Apply a search term that results in no matching data, and it would be replaced when the end user starts typing.


  • colincolin Posts: 15,095Questions: 1Answers: 2,581

    Here's an example of Allan's first suggestion - it hides the rows when there's on search,


Sign In or Register to comment.