-
Notifications
You must be signed in to change notification settings - Fork 279
Description
- 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:
- Save the HTML/JS page here (https://paste.tomsmeding.com/IGruPlzp/raw/1) to /tmp/demo.html (also attached to this)
- Open /tmp/demo.html with your browser
- Click the "Ext." button at the top.
- Go to the search field under "Completion".
- Type "2005" and see that it is filtering according to the column that previously occupied its space (the "Start Date" column)
Expected behavior
- Save the HTML/JS page here (https://paste.tomsmeding.com/IGruPlzp/raw/1) to /tmp/demo.html
- Open /tmp/demo.html with your browser
- In the search field below "Completion", type "3".
- 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.