Sorting with render function not working (even with type == "sort")

Sorting with render function not working (even with type == "sort")

TouchToneTouchTone Posts: 2Questions: 1Answers: 0

I'm trying to use a render function to format file sizes nicely, but sort on the original numbers. Unfortunately, even though the render function responds to type "sort" with the raw data, sorting is done on the display data.

Example at http://live.datatables.net/wosedec/3/edit?js,output . The files have increasing size with increasing number, so sorting by size or name should always give a sorted name list, but it doesn't.

Any ideas?

Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    edited May 2014 Answer ✓

    Hi,

    I think the issue here is that you also want to return the raw data for the type type :-). i.e. the type detection that DataTables runs. Otherwise is is detecting a string type.

    Updated example: http://live.datatables.net/wosedec/4/edit

    Allan

    edit Nice use of orthogonal data btw. I do love it :-)

  • TouchToneTouchTone Posts: 2Questions: 1Answers: 0

    That did the trick! Thanks a lot, Allan!

    After working with Qt's MVC code for a while I'm getting up this way of thinking, and I'm starting to like it. ;)

This discussion has been closed.