How can I make a column non-sortable?

How can I make a column non-sortable?

adrianadrian Posts: 4Questions: 0Answers: 0
edited August 2010 in General
Hi,

I have a table with 4 columns. The first 3 should be sortable, the fourth only contains action links and should therefore not have a sort icon in the header.

I've managed to get this behavior by only specifying three columns in the aoColumns array. But then I get the following warning:

DataTables warning (table id = 'CurrentTasks'): Unexpected number of TD elements. Expected 208 and got 416. DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.

Everything else seems to work fine though.

By Specifying null as the fourth aoColumns element I can get around the warning, but then the column is sortable again.

How can I get rid of the warning and still keep the fourth column as non-sortable?

Thanks,

Adrian

Replies

  • abbottmwabbottmw Posts: 29Questions: 0Answers: 0
    Take a look at this page
    http://www.datatables.net/usage/columns
    and scroll down to bSortable. in your aoColumns, you need to add { "bSortable": false } for the column(s) you dont want to be sortable.

    Hope that helps.

    -Matthew
  • adrianadrian Posts: 4Questions: 0Answers: 0
    argh... How could I overlook this? Thanks a lot, Alan! :-)
This discussion has been closed.