Disable sorting when table has only one row?

Disable sorting when table has only one row?

jeffwjeffw Posts: 38Questions: 5Answers: 0
edited April 2013 in General
Is there a way to prevent sortable headers when there's only one row in the table? By default it lets you still sort the columns.

thanks,

Jeff

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    No - features such as that cannot currently be enabled and disabled on-the-fly. You could modify DataTables to do it easily enough, or use fnDrawCallback and fnSortListener (remove and detach the listeners whenever the number of rows are updated), but there is no built in way of doing that.

    Allan
  • jeffwjeffw Posts: 38Questions: 5Answers: 0
    Thanks Allan. I can do what I need by calling dataTables only when there are more than 2 rows in the table (1 header, 1 data).
This discussion has been closed.