ordering of datecolumn with moment not correct
ordering of datecolumn with moment not correct
Hello together,
Im using moment.js to sort a datecolumn. When im using the rawdata within the <td>
only, it works perfect as you can see here:
http://live.datatables.net/newinohi/1/edit
(if you order the datecolumn everything is perfect ordered)
Since im not using the rawdata for the <td>
within the application (i have some more html-elements like <div>
and <label>
) i thought i could just replace them within the ColumDefs and get the right ordering back. But this seems not to work somehow as you can see here:
http://live.datatables.net/yulinaxe/1/edit
(if you order the datecolumn now its not correct ordered anymore)
Do you have some ideas to solve this?
greetings and best regards
patrick
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Replies
You need to do it for the
type
type as well, so DataTables can run its type detection on that returned data: http://live.datatables.net/yulinaxe/7/edit .I've pulled the
textarea
out into a single variable so it can keep reusing the same value. Even then it isn't the most performant way of doing it - stripping the HTML (since it is basic HTML) with regex would do without doing DOM write and reads in the renderer (any DOM interaction is slow and should be avoided if possible).Allan
uhh nice. thanks allan! your awesome!