javascriptjquerydatatables

jquery datatables hide column


Is there a way with the jquery datatables plugin to hide (and show) a table column?

I figured out how to reload the table data: using fnClearTable and fnAddData.

But my issue is that in one of my views for the table (e.g. a hidden mode) I don't want to show certain columns.


Solution

  • You can hide columns by this command:

    fnSetColumnVis( 1, false );
    

    Where first parameter is index of column and second parameter is visibility.

    Via: http://www.datatables.net/api - function fnSetColumnVis