Is it possible to order a table by data displayed in a child field?
Is it possible to order a table by data displayed in a child field?
mccwebdev
Posts: 20Questions: 6Answers: 2
I have a table similar to this example that makes use of child rows.
https://datatables.net/examples/api/row_details.html
Within that child row is some additional information of which one is a last updated date/time. Is it possible to sort by this date/time field that is included as part of each rows child set?
This discussion has been closed.
Answers
The data in the child rows is independent of the Datatable. Meaning Datatables does not know about it and can't sort by it. However if you include the last updated date/time in the Datatable row data you can sort using it. Place that data in a hidden column using
columns.visible
. Then set your initial Datatable order using that column withorder
.Kevin
That worked like a charm, thanks!