Skip to main content
miked0005
August 2, 2023
Question

Sorting GridField by Icons

  • August 2, 2023
  • 4 replies
  • 0 views

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
August 2, 2023

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
August 2, 2023

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
August 3, 2023

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.