Data Grid Sorting

If by grid layout, you mean a repeating panel with some column names? If so, yes, it’s easy. Here’s my column headers (Label component) for a repeating panel:

image

When the user clicks on a column name, it sets the sort icon accordingly and then I simply sort the items in the panel - no need to re-query the database. Here’s the sort operation:

self.repeating_panel.items = sorted([r for r in self.repeating_panel.items], key = lambda x: x[sort_field], reverse = (sort_order == ‘desc’))

sort_field and sort_order are variables that I set before this line of code.

Does that help?

2 Likes