No sorting for ordinal columns

No sorting for ordinal columns

luongleluongle Posts: 1Questions: 0Answers: 0
edited May 2009 in General
Hi all,

Could DataTable help me sort a column so that order of values of ordinal column (its values 1, 2, 3...) doesn't change? If yes, hope everyone help me... pained because of it for some days!

Thanks advance!

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    This isn't something which is built into DataTables, but could be done through a callback function. What to do is to use fnDrawCallback() ( http://datatables.net/usage#fnDrawCallback ) to renumber your ordinal column on each draw. To optimise this it would be good to check the value of aaSorting from the last draw against the current aaSorting value to see if the sorting has changed. In this way you can update the ordinal only if needed.

    Hope this helps! If you make any head way with this code, perhaps you could post it here? I'm sure others would find it useful as well!

    Regards,
    Allan
This discussion has been closed.