In my application I am using the List.js for sorting purpose. All the "string" values are working fine. But I do have the "modified date" in the column.
When I click "modified by date" - to sort, this is just considering the date values what is there is the text, ex: 1/4/11.. and sorting accordingly. because of this approach I am getting wrong sort orders.
how can I make instead it should sort by the real value of the number's what the dates are?
Here is my code:
new List('mfi-col2', {
valueNames: ['companyLegalName', 'phazeName', 'contactName', 'number', 'enrollId', 'accountType']
});
Instead of "number"
is it possible to send $(".number").data-number
? So let it use the time stamp that I am getting from server?
Or can anyone suggest an alternative for this plugin?
You could use a data-attribute, too:
js
valueNames: ['date', { name: 'timestamp', attr: 'data-timestamp' }
html
<td class="date timestamp" data-timestamp="1427713871">30/03/2015</td>
Now you are able to sort via timestamp without a second or hidden field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With