Custom Sort Algorithm?
Custom Sort Algorithm?
Hey guys,
This should be either a quick "yes you can" or "no you can't" kind of question.
I'm looking for a way to specify my own sort algorithm. With other plugins similar to DataTables, it would be something where I could specify a function that would then return a numeric (?) value that's used to sort the content instead of the content itself.
This means that if you have meaningful data amidst other data (i.e. "Price: $150") you can use DOM scripting to extract the meaningful data (i.e. 150), or provide smart sorting (i.e. where values of "small" = 1, "medium" = 2, "large" = 3, etc.) that can be sorted easily.
I've scoured the documentation, but I find it a little overwhelming. Is there an easy way to accomplish this?
Thanks,
-Nate
This should be either a quick "yes you can" or "no you can't" kind of question.
I'm looking for a way to specify my own sort algorithm. With other plugins similar to DataTables, it would be something where I could specify a function that would then return a numeric (?) value that's used to sort the content instead of the content itself.
This means that if you have meaningful data amidst other data (i.e. "Price: $150") you can use DOM scripting to extract the meaningful data (i.e. 150), or provide smart sorting (i.e. where values of "small" = 1, "medium" = 2, "large" = 3, etc.) that can be sorted easily.
I've scoured the documentation, but I find it a little overwhelming. Is there an easy way to accomplish this?
Thanks,
-Nate
This discussion has been closed.
Replies
http://www.datatables.net/plug-ins/sorting
It looks like the "Priority" example may best match your need.
Matthew
Thanks, works for me