Pagination breaks columns.visible()
Pagination breaks columns.visible()
I have been trying to get some custom sorts in my DataTable done. One of the "features" the table should have is that there is one column that is normally hidden, but can be shown for additional information/features.
As you can see here if you "show" or "hide" the 1st column and then change the pagination length, the table breaks as some part of column 1 are "display:none" and others not.
columns(".jsSelect").visible(false) doesn't work either. Is there a quick fix I am missing?
This question has an accepted answers - jump to answer
Answers
Have you looked at using Column Visibility from the Buttons Extension?
See if this example does what you want.
I might be missing it but I'm not seeing where you use
column().visible()
API. If you don't want to use the above the try usingcolumn().visible()
instead ofshow()
andhide()
.Kevin
in the live code I do use
column().visible()
but sadly this was throwing an error in the fiddle so I used theshow()
andhide()
from jQuery to show the errorWhat is the error?
Using
column().visible()
seems to work in this updated example:https://jsfiddle.net/jhp9u237/
Please update the test case to replicate the issue.
Kevin
Thanks a lot!
In my live code I used $('#example').columns() instead of $('#example').DataTable().columns() which still hid the column but not the ones on other pagination sides... which might have been the reason it didn't work in the jsfiddle.