Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide or show a column after a jquery data table AJAX callback

Using JQuery data tables it is easy to retrieve the content of the table using AJAX . The problem I am having us the ability to hide or show a column as the user pages through the data. In the table there is a column with a check box but not all the rows will have the checkbox. If the current page does not have any rows with checkboxes how do I hid that column and them have it be shown when to user pages (using the data table paging functionality) to a page with rows containing text boxes?

like image 841
M Smith Avatar asked Nov 30 '25 09:11

M Smith


1 Answers

I found the answer:

In fnDrawCallback, call this.fnSetColumnVis( 5, true); to show the 6th column (0 is the first column) and this.fnSetColumnVis( 5, false); to hide that same column.

like image 141
M Smith Avatar answered Dec 02 '25 21:12

M Smith