Hide empty columns in dataTable after searching
Hide empty columns in dataTable after searching
Link to test case:
https://jsfiddle.net/epygvwz9/3/
I want to achieve:
My full table contains all dates, but when I search for a given company or person, for example, Tom, then I just wanna keep dates that are not empty for Tom's row. In this case, only 9-16, 9-15, 9-9 are shown.
Description of problem:
There is some styling issues when I enter 'Tom' in search bar, but after I hit F12, the data table displays correctly except for contents overlap in the first two columns.
I tried to achieve the functionality by writing own codes, but it would be better if there is built-in function.
It seems like the hide empty column plugin https://datatables.net/forums/discussion/31528/new-plugin-hide-empty-columns
doesn't work in search bar.
Answers
Same issue happens when I delete 'tom' in search bar. All dates are displayed correctly after F12, but contents overlap in these fixed columns.
I solved this issue by adding
table.draw()
after filterEmptyCols function