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?

mccwebdevmccwebdev 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?

Answers

  • kthorngrenkthorngren Posts: 21,448Questions: 26Answers: 4,974

    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 with order.

    Kevin

  • mccwebdevmccwebdev Posts: 20Questions: 6Answers: 2

    That worked like a charm, thanks!

This discussion has been closed.