Custom sorting (plug-in) doesn't save state?

Custom sorting (plug-in) doesn't save state?

deepbluedeepblue Posts: 3Questions: 0Answers: 0
edited April 2014 in Plug-ins
I'm using the natural sort plugin for a particular column. It sorts fine - no problems there.

I'm also using stateSave and it saves the sorting state just fine. Except, for the column I'm sorting using the natural sort plugin.

I have analyzed the data in the localStorage and the stateSave is saving the column and its order. But the order applied upon table loading is not the one of the type of the column ('natural') but something else (seems numeric).

I couldn't find anything about this through the forums. I'm using 1.10.0-beta.2. Have tried the nightly and has the same behavior.

Is this a bug or am I doing something wrong?

Replies

  • allanallan Posts: 54,897Questions: 1Answers: 8,605 Site admin
    Can you link to a test case showing the issue please. There should be no problem about using state saving and ordering plug-ins.

    Allan
  • deepbluedeepblue Posts: 3Questions: 0Answers: 0
    I put together a small example:

    http://mentalstring.net/datatables/example0.html

    - Default order: by the name column
    - The test column uses the 'natural' type for sorting
    - When changing the order of the name column, the state is saved and respected upon reloading
    - When changing the order of the test column, upon reload, the sorting column is the correct one, the order (ascending) too, but the sorting seems to be done numerically, no with the 'natural' type.
  • allanallan Posts: 54,897Questions: 1Answers: 8,605 Site admin
    How very odd! Thanks very much for the test case. I will download this when I'm back in the office tomorrow and figure out what is going on. I'll post back here when I've got a fix.

    Regards,
    Allan
  • allanallan Posts: 54,897Questions: 1Answers: 8,605 Site admin
    Thanks again for the test case! The fix is committed here: https://github.com/DataTables/DataTablesSrc/commit/d93e8e30 and it now in the "nightly" build of DataTables 1.10: http://datatables.net/download .

    Regards,
    Allan
  • deepbluedeepblue Posts: 3Questions: 0Answers: 0
    Glad I could be of help and thank you for fixing it so promptly!

    While I have you, and speaking of the nightly, the build date for v1.10.0-beta.3.dev on https://next.datatables.net/download seems to be stuck on March 6th. The build itself seems to be up to date, just the date seems to be wrong.

    Cheers!
  • allanallan Posts: 54,897Questions: 1Answers: 8,605 Site admin
    Oops - thanks for noticing that. I'll check it out.

    Allan
This discussion has been closed.