How to apply sorting when adding a row as a DOM node
How to apply sorting when adding a row as a DOM node
Hi
I have a use case where I need to add rows dynamically via javascript. I want to add the row as a dom node inline as it is what best suits my circumstances. So I am doing something like the following:
var name // String
var dob // Date
table.row.add('<tr><td>' + name + '</td><td>' + dob.format('dd-mm-yy') + '</td></tr>')
However with this approach the sorting will not be correct on the DOB field. I would need a way to tell it to sort by dob.getTime(). Is there a way I could do this?
Thanks
Des
Answers
Try adding it as a jQuery object, like this: