Sort Filter Dialog

Is there any way to enforce a sort order on the items in an object-table filter dialog:

image

I think it’s defaulting to number of hits in the table? Or it might even just be order of appearance in returned results? Could I make it alphabetical somehow instead? Without affecting the orderBy criteria on actual objects in the table.

I know of a way to inject an actionSheet with a custom order of the items here, but that is only single select. Does your filter need to be multi-select?

It might be - I’d have to check with the client, but it would be great to see some example code so I can try it out.

You can check out the template app called “Showcase - Object Tables”. Specifically, the controlled_table view, line 14 of the XML. That onRelationshipFilterOptions() function calls a function named sharedKeyActionSheet() that takes some options.

The sharedKeyActionSheet() creates an array that looks like this:

[
  { "text": "West District" },
  { "text": "South District" },
  { "text": "North District" },
  { "text": "East District" }
]

When you click on the header icon, those options are shown in the filter in the native order they have in the array.

Bit of a workaround, but let me know if this works or not!