objectDataTable sort order

We’re using objectDataTable() heavily. But I can’t find an option to define a sort order. In my use case I use the same data table, but in one place I’d like to order it default by title, in the other place sort by date.

Would be a very useful enhancement.

On your component, annotate with @datamanagerDefaultSortOrder mysortorder

This is exactly what not works for my use case. On page A I need a sorting by Date, on page B I need all sorted by title.

The annotation only helps for one case.

Ah I see. Yes, not possible right now. I think it would likely be a modification to /preside/system/views/admin/datamanager/_objectDataTable.cfm to have this working. Adding a `args.sortOrder" so that you would call like:

#objectDatatable( objectName="my_object", args={ sortorder="title" } )#

Would defo take a PR for this.

1 Like