order by checkbox?

order by checkbox?

veloopityveloopity Posts: 87Questions: 36Answers: 2

My datatables carry a checkbox as first column. It does not contain data from the database tables but is used to mark rows whose IDs (when a certain link is clicked) can be sent to another page for comparisons. My customer wonders why the checkbox column is not sortable. I don't think it can be made sortable - all other column headers can be clicked on to sort the data in various ways - their column ID is transferred to Ajax as form["order[0][column]"] and form["order[0][dir]"] and is used to dynamically create an SQL statement, so each time a column header is clicked, a new database request is created.
Am I right that datatables cannot be sorted by columns (like that checkbox) that are not part of the database table?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    I'm guessing from your description you are using server-side processing (serverSide)? If so, then no, the checkbox column cannot be sortable. The reason for that is that the checked state is client-side, but the sorting is all happening at the server-side. Thus the server-side doesn't have the information available to be able to sort the column.

    Allan

Sign In or Register to comment.