sorting -pre -asc and -desc

sorting -pre -asc and -desc

xtech_devxtech_dev Posts: 21Questions: 9Answers: 0

I'm developing custom ordering plugin based on:

What is the meaning of -pre function? Does it prepare data for -asc and -desc functions or -asc and -desc does not matter when -pre is defined?


  • xtech_devxtech_dev Posts: 21Questions: 9Answers: 0

    Ok, got it.

    -pre wont work with -asc, -desc (it's a pity).

    From docs:
    "Note that in DataTables 1.10 a pre-formatter cannot be used with custom -asc and -desc methods - to use custom ordering functions you cannot apply a pre-formatter. This limitation will be addressed in the next major version of DataTables."

  • colincolin Posts: 5,549Questions: 0Answers: 970

    Hi @xtech_dev ,

    I think that comment is out of date - it does work with them, see a one of my plugins here.

    In that example, the "-pre" formats the data into something that's easily comparable by the "-asc" and "-desc" functions. If there isn't a "-pre" function, the "-asc" and "-desc" will just use the raw data for that cell.

    Hope that helps,



  • xtech_devxtech_dev Posts: 21Questions: 9Answers: 0

    Well it seems that -pre function does not takes in to account the .render function. I have done some preprocessing in my render function for non 'display' type. But when -pre is running not calls for render are made.

  • kthorngrenkthorngren Posts: 6,084Questions: 21Answers: 1,347

    I built a simple example based on the example in the doc you linked to. The -pre function seems to work:

    Please provide an example of what you are trying so we can help debug.


Sign In or Register to comment.