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
Discussion posts and replies are publicly visible
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.
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.
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.
I was hoping to find a way without resorting to modifying the underlying data.
I did just just like you mentioned - created a new field with logic in the underlying view and it's sorting fine on the grid