Persist sort in datagrid

I have a DataGrid where most columns are sortable.
When the user leaves the page, I want to capture how the grid is currently being sorted by, ie. a value like "{propertyName} desc".
How do I get that? It doesn't seem like its a value that is available, but can I override the sorting to keep track of it myself?
Additionally, i will need to set the sort again. I could order the data before i load it, but can this be done on the grid itself?

1 Like

You can use LoadData to get info about sorting, filtering, paging, etc.:

There are examples how set sorting and filter when the grid is loaded for the first time: