Hi guys, I was having trouble sorting manual data for custom data present in column like A, A++ , A+, A-- , A-. The Jquery plugin for this one I am using is- datatables.net . Currently the sorting is working fine for conventional datatypes such as Int - 1,2 3,4,5 Char- A, B, C, D. Does anyone know how to make it work on manual data as well?
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (4)
Thanks @rhymes & Ben.
After lots of research, I came across:
github.com/Mottie/tablesorter/issu...,
and used it like this:
Table is now getting sorted as expected :)
What if you create a custom plugin for sorting?
According to datatables.net/reference/option/co... sorting is done on a few predefined types BUT:
There's an example on how to create custom sorting here: datatables.net/examples/plug-ins/s...
That's an interesting problem. Maybe modify the plugin to translate the input before it computes the sort? If it replaced, for example, "+" with "A" and "-" with "B" before computing the sort it would work, right?
I'm not sure this is the cleanest way to go about it but it's what comes to mind. It wouldn't be too tough to pop into the code and insert a
.replace()
in.Hey! I've noticed that in this post you use "guys" as a reference to the entire community, which is not made up of only guys but a variety of community members.
I'm running an experiment and hope you'll participate. Would you consider changing "guys" to a more inclusive term? If you're open to that, please let me know when you've changed it and I'll delete this comment.
For more information and some alternate suggestions, see dev.to/seankilleen/a-quick-experim....
Thanks for considering!