Skip to main content
miked0005
New Participant
Aug 2, 2023 6:31 PM UTC
Question

Sorting GridField by Icons

I have a gridField where one of the gridColumn is displaying an icon for its value (icon is displayed as a richTextIcon in a richTextDisplayField). In this column, it can either have the icon or not (null). How would I go about configuring the sortField for these values since they're not necessarily field values. I would like to sort so all rows with the icon are at top (or bottom). Thanks

4 replies

stefanhelzle0001
Brainy
Aug 2, 2023 6:49 PM UTC

I assume that the icons are not the real values, but used for visualisation. Did you try to sort on that values? What is the data source? If it is a record, you could use a custom record field for the icons and then just sort on this field.

miked0005
miked0005Author
New Participant
Aug 2, 2023 7:05 PM UTC

Correct the icons hold no value, but used for visualization. To determine whether or not to display the icon, we have an expression rule that takes in an id value (i.e. fv!row.id). However we can't use the same expression in the 'sortField' parameter since it doesn't recognize fv! like it does in the 'value' parameter of gridColumn. The data source is a view we're querying from, not a record.

stefanhelzle0001
Brainy
Aug 3, 2023 6:38 AM UTC

Sorting is alway done on the underlaying data, not the visual representation. You will then have to implement the logic in the view.

I had a situation in which I created a separate integer field, and some logic, in the view, just to get the sorting right.