Sorting datagrids

I have a datagrid that will not sort. I have the option selected to allow sorting of the grid and all of the fields sort property is filled in. The filter function works fine. I do have a default Order by Created desc set in the invoke method on load. Would that cause this issue?

Is it in-memory data (only Page load) or server-side with DataGrid loadData?

Can we reproduce this in the application you have already sent over email? If yes - please tell us which page to try.

I made changes to it since I sent it over. It was turned off. It is the Deals page that does it. Here is where the default sort is put (on the page not grid). I believe that is server side. You can see the behavior in the production login though.

Can you also show how the LoadData handler of that DataGrid looks like? It is responsible for invoking the data source method during paging, sorting and filtering.

I think this is the problem. I only have the Created desc in the order by on the datagrid. It is missing the event sorting. How would I get a datagrid to default to Created desc and allow the user to change it. It would need to keep the custom sort through paging etc but go back to default if the page was closed and reopened.

The code in the page Load event determines what the DataGrid will display initially. If you want to override the sort order later just set the $orderby parameter to ${event.orderby}. The latter represents the current DataGrid sort state.

Perfect. Worked great Thanks!