DataTables – automatic recognition of which table columns contain date/time information
I’ve used the JavaScript DataTables plug-in for jQuery a lot. It’s great for easily adding sorting to tables and lots more. It works nicely with Bootstrap too. The clunkiest thing I’ve found is trying to sort columns that contain date / time information. In the past, I used the datetables-date-sort.js plugin, which allows you to specify for each column what the data type is e.g. <script type="text/javascript"> $(document).ready(function () { $("#myTable").dataTable({ "aLengthMenu": \[\[10, 25, 50, -1\], \[10, 25, 50, "All"\]\], "iDisplayLength": -1, "aoColumnDefs": \[ { "bSortable": false, "aTargets": \[0\] }, { "asSorting": \["asc", "desc"\], "aTargets": \[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\] }, { "sType": "uk-date-time", "aTargets": \[8,10\] } \] }); }); </script> That’s nice and flexible but you have to specify it for each table and, worse still, you have to (remember to) change it each time you add/remove/reorder columns. ...