Custom Sorting Question
-
Hi – love your plugin – had a question about custom sorting.
Not entirely sure what I’m doing with this but I’m trying to sort by “strings” for heights in feet/inches like so “5-11” for 5 feet 11 inches. Unfortunately the default sorting puts 5-11 behind numbers like 5-6 – which makes sense logically.
Can I specify a custom sort order using the DataTables extension? I’m a little lost – but here’s what I have,
“columnDefs”: [ { “type”: “formatted-num”, “targets”: [ 3 ] } ],
“order”: [ {
“5-0”: 0,
“5-1”: 1,
“5-2”: 2,
“5-3”: 3,
“5-4”: 4,
“5-5”: 5,
“5-6”: 6,
“5-7”: 7,
“5-8”: 8,
“5-9”: 9,
“5-10”: 10,
“5-11”: 11,
“6-0”: 12,
“6-1”: 13,
“6-2”: 14,
“6-3”: 15,
“6-4”: 16,
“6-5”: 17,
“6-6”: 18,
“6-7”: 19,
“6-8”: 20,
“6-9”: 21,
“6-10”: 22,
“6-11”: 23,
} ]I’m sure my syntax and other things are causing problems – not entirely sure what to change – any help would be great!
- The topic ‘Custom Sorting Question’ is closed to new replies.