–sorting on date column plug-in for jQuery is a powerful javascript library for managing HTML tables.

The following is a note on how to solve a common issue: sorting on the value of a column when the displayed value is different.  An example of this is when a date is displayed as a friendly string like Month Year:


The default sorting behaviour would end up with less than desirable results:


There are more than one way to solve this, but a simple solution is to include an additional hidden column with the date value.  Then in the column defs the column to be sorted, in this case the first column or 0 index, can reference the hidden column when sorting:

“columnDefs”: [{                       
                       “targets”: [0],
                       “dataSort”: 4 },
                       “targets”: [4],
                       “bVisible”: false

The end result is correct sorting on the hidden column:


This entry was posted in, HTML, JavaScript, JQuery. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *