How to resize jquery.dataTable object after showing/hiding columns?
At my client's request, I am writing a web interface to a table with 73
columns! I presume that oftentimes, a user may want to view only a few of
these columns at a time.
I programmed my web application to display checkboxes for each column and
then use the fnSetColumnVis() function to hide the columns that the user
doesn't want to see.
Technically, it seems to work fine. If only two checkboxes are checked,
only two columns are displayed, for example. However, the table remains as
wide as it was when all 73 columns were displayed.
I would like for the table size to be adjusted appropriately when the
number of columns changes.
I tried using the $.width() function as described here: How to resize a
JQuery/Datatable after hiding columns, but that doesn't seem to do
anything. I think that it may have to do with the fact that the poster of
the above question used percent widths in his table layout, but my table
header row looks like <th>col1</th><th>col2</th><th>col3</th>.
I will also add that I'm using AJAX here.
No comments:
Post a Comment