Skip to content

[BUG] Searching visible columns doesn't work when hiding others #451

@seydar

Description

@seydar
  • I have looked through the documentation to try to see if this behavior is documented.
  • I have looked at the demos to see if one of them handles this, but none of them did.
  • I have created a jsfiddle here: [INSERT LINK] that demonstrates the issue.

Describe the bug
I am trying to combine demo #20 (individual column search filters) and the DataTable.columns.hide functionality. I have a lot of columns, so I would like to hide the ones I'm not interested in while searching through the remaining columns.

I took the 20-column-filters/index.html code and then added one function at the top to hide columns (lines 21-31), a div for column visibility (lines 33-37), and then 12 lines at the bottom (lines 794-806) to programmatically add the column visibility buttons based on the headers in the table.

Also: I changed line 756 to use "simpleDatatables.DataTable", and I load the latest library on line 10, so that it can work as an independent file that you just open with your browser.

To Reproduce

Steps to reproduce the behavior:

  1. Save the HTML/JS page here (https://paste.tomsmeding.com/IGruPlzp/raw/1) to /tmp/demo.html (also attached to this)
  2. Open /tmp/demo.html with your browser
  3. Click the "Ext." button at the top.
  4. Go to the search field under "Completion".
  5. Type "2005" and see that it is filtering according to the column that previously occupied its space (the "Start Date" column)

Expected behavior

  1. Save the HTML/JS page here (https://paste.tomsmeding.com/IGruPlzp/raw/1) to /tmp/demo.html
  2. Open /tmp/demo.html with your browser
  3. In the search field below "Completion", type "3".
  4. See success: it filters the rows.

Additional context
On line 783, we specify the column that the search box checks. The index is a relative, changing number but appears to be indexing the absolute column number.

I'll also add that while I can produce this bug in this MRE, in my actual codebase I am unable to get ANY results to show — it always just goes straight to "no results". I'll have to do some more digging on that part.

demo.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions