Need help with sorting
Need help with sorting
I need assistance sorting the first column. I have a column with a mix of alpha numeric values. Is it possible for the column to ignore the alpha values and only sort by numeric values?
See test case: http://live.datatables.net/peyinuhi/2/edit
In my table, for example, AA-EC-1991-175 and AA-MW-1991-136 should ignore alpha values and sort by 1991-175 and 1991-136. As a result, the expected outcome should be:
AA-MW-1991-136 test5 test5 test5 (first)
AA-EC-1991-175 test1 5 16
This question has an accepted answers - jump to answer
Answers
Yes that is possible, but you'll need a custom ordering plug-in to do it. Strip the non-numeric data and then parse the numeric data into something that can be sorted - e.g. in this case "YYYY0BBB" might work (where YYYY is 1991 and BBB is the 136 part).
Allan
Thanks Allan. I am not a developer. I am not sure how to proceed with what you mentioned. Can you please guide me. Thanks
The first thing to do is to extract the text from the
ptag. Then parse the string to get to get the two numeric values. Pad the last number with0s to make them all the same length. The place the0between the two numbers as Allan suggested.Using Orthogonal data you can return this new string for the
-type(type detection) andsortoperations. For exampleAA-EC-1991-190would be19910190andAA-EC-2011-50would be20110050. I changed a couple of the data points toAA-WE-2010-30andAA-MW-2010-101to illustrate the sorting of the variable length digits for the last part. See this example:http://live.datatables.net/peyinuhi/4/edit
Kevin
Thankyou very much!. This worked!!