Datagrid default sort order + keeping reordering feature

Hi,
I am trying to set a default sort order on on a column in a data grid, and it seems I have to choose between the re-ordering feature or fixed default sort order.
This setting gets me a functional re-ordering feature:


And this setting gets me my default sort order:

How do I combine both on a Blazor webassembly project? I have tried all of the following without success:
${event.orderby} || "name"
${event.orderby} || 'name'
${event.orderby} || "name asc"
${event.orderby} || 'name asc'
${event.orderby} || name
${event.orderby} || name asc
and all of those with
${event.orderby || }

Is there a syntax that actually works on this?
If you have a solution that requires working in the code directly and excluding the file, no need to post it.

Thanks!

The correct syntax is: ${(!string.IsNullOrEmpty(event.orderby) ? event.orderby : "Id desc")}

default-order-wasm

1 Like

Thanks enchev!

This is great, I will study it carefully to figure out what is possible!!!

Regards,
Francois