Our clients would like to see an icon displayed next to the column header of a grid to indicate by which column  the grid is currently sorted by. The icon should indicate descending or ascending sort order.

We're using the List_SortColumn widget to do the sorting. I didn't see anything built in to indicate the sort order.

I noticed that there are styles that are applied to the headers called SortColumns_Sorted and SortColumns_Sortable. So maybe we can do something with font aswesome styles and jquery.

Has anyone done something like this?

Thank you.
Hi Fabian,

Unfortunately, RichWidgets doesn't provide this functionality out of the box (though I think it should). However, you may be able to circumvent this by doing some housekeeping yourself in the screen action called, possibly in combination with some CSS styling.

Yes we can display the icons with :before and :after CSS styling with "content CSS attribute" 

I appreciate this discussion is quite old but I have a similar issue to Fabian and it doesn't seem to have been fully resolved. 

I understand how to add custom css styles to the  "SortColumns_Sorted" class to display ASC or DESC icons. The problem is determining how the column is currently sorted so I know which icon to display.

Successive clicks on the same column header will switch between ASC and DESC sorting but this isn't really reflected in the DOM. There's the "SortColumns_Sorted" class that indicates a column is the one being sorted, but no additional classes are added when the sort order changes from ASC to DESC. 

Is there someway I can query the aggregate to see how it is currently being sorted?

Any help would be much appreciated :)

Richard Ward wrote:

I appreciate this discussion is quite old but I have a similar issue to Fabian and it doesn't seem to have been fully resolved. 

I understand how to add custom css styles to the  "SortColumns_Sorted" class to display ASC or DESC icons. The problem is determining how the column is currently sorted so I know which icon to display.

Successive clicks on the same column header will switch between ASC and DESC sorting but this isn't really reflected in the DOM. There's the "SortColumns_Sorted" class that indicates a column is the one being sorted, but no additional classes are added when the sort order changes from ASC to DESC. 

Is there someway I can query the aggregate to see how it is currently being sorted?

Any help would be much appreciated :)


I've answered my own question. The ListSortColumn_GetOrderBy screen action returns the sort order of any table widget. 

Hi! 

You can always look for " DESC" string in the last  5 characters from the List_SortColumn_GetOrderBy function. 

Something like :

index(List_SortColumn_GetOrderBy(MyTable.Id, DefaultOrder: "Id") , " DESC") <> -1
and length(List_SortColumn_GetOrderBy(MyTable.Id, DefaultOrder: "Id")) > 5

 Hope this idea helps you

Graça