I am currently creating an Agile Scrum project management web application. I am displaying a list of stories in a table with one column being their priority in MoSCow (Must, Should, Could and Won't) I am new to datatables and wondered how i would go about ordering by a custom data set [Must, Should, Could, Wont]
A custom sort filter should do the trick, something like this:
$.extend($.fn.dataTableExt.oSort, {
"moscow-pre": function ( a ) {
var vals = ["Won't","Could","Should","Must"];
return $.inArray(a, vals);
},
"moscow-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"moscow-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
Working example here. Hope that helps.