DataTables ordering

DataTables ordering

hubohubo Posts: 45Questions: 14Answers: 0

When the first item (row) in the table has no value (by which it can decide how to order the column) or data-order attribute, it will order the column as a string.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Please link to a test case showing the issue, per the forum rules.

    If you mean that you want to use the data-order attribute to provide sorting information, that attribute must be available on all rows.

    Allan

  • hubohubo Posts: 45Questions: 14Answers: 0

    I am using data-order="" as a workaround for the empty columns. Is it right? Will it compare as a number if the other data-order values are data-order="21", data-order="100"?

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Answer ✓

    That is fine as long as you set the data-order attribute for all cells in that column. For efficiency reasons DataTables won't check every row it reads in for attributes that might not exist - hence why the decision to do so is based on the data in the first row.

    Allan

This discussion has been closed.