Previously I had setup my Grids so that I could remember their sorting order as a saved preference. To do this I had the following code where sortOrderList is a String:
for(SortOrder sortOrder : grid.getSortOrder())
{
String gridSortOrder = sortOrder.getPropertyId()
+ GRID_SORT_PREFERENCE_SEPARATOR
+ sortOrder.getDirection()
+ GRID_SORT_PREFERENCE_NEXT_SEPERATOR);
}
Unfortunately this code no longer works. I saw in the following in the documentation:
grid.setSortOrder(GridSortOrder.asc(cityColumn).thenDesc(nameColumn))
Which will make parsing it back different but the problem is how do I parse the existing sorting order into a String? The main issue I’m running into is that sortOrder.getPropertyId() no longer exists. This lead me down the lines of trying to loop through the columns but I also ran into another issue here:
column.getSortOrder(sortDirection)
I don’t understand why I have to add a SortDirection object to get the SortOrder. In any case it brings back a stream which wouldn’t work if you have multi-column sorting. At least that’s my thinking.
So my question is how can I get a list of the columns being sorted as well as what the sorting order is for each column?