php - Sort datatable by month name column -
i want sort datatable month name , month names in french how . have searched alot didn't result. of great use . thank you
you have searched? dont think so
order field(month,'january','february','march',...) select leave_balance.balance, monthname(leave_balance.date_added) month leave_balance leave_balance.staff_id_staff = $iid group month, leave_balance.leave_type_id_leave_type having leave_balance.leave_type_id_leave_type = $leavebaltypid order field(month,'january','february','march',...,'december');
duplicate from: mysql - order monthname
first google result
datatables, bad, , still, first result ;)
var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; jquery.fn.datatableext.osort['month-name-asc'] = function (x, y) { var xpos, ypos; jquery.each(monthnames, function (k, v) { if (x == v) xpos = k; if (y == v) ypos = k }); return ((xpos < ypos) ? -1 : ((xpos > ypos) ? 1 : 0)); }; jquery.fn.datatableext.osort['month-name-desc'] = function (x, y) { var xpos, ypos; jquery.each(monthnames, function (k, v) { if (x == v) xpos = k if (y == v) ypos = k }); return ((xpos > ypos) ? -1 : ((xpos < ypos) ? 1 : 0)); };
http://drmsite.blogspot.com/2013/08/datatables-custom-sort-by-month-name.html
Comments
Post a Comment