Hej
September 13, 2019, 11:48pm
1
I’m new to radzen (great concept by the way)
I created an angular + server app off an Mssql db
I’d like to change the initial sort order on one of the ‘list’ views for one of the tables
It’s doing it by the first column/primary key asc by default, but I want to see the newest records first
I want it to be by one of the date columns desc
I can’t see any setting at the data grid properties level to modify the data source query or a sort order property
I tried messing with the onload event but again it didn’t do anything or caused the data grid to not load all
How do I change the initial sort order?
korchev
September 15, 2019, 7:49am
2
You can specify the sort order via parameter of the Invoke Data Source Method action. For Blazor applications it is in the Load event of the page. For Angular applications it is in the LoadData event of the DataGrid. You can use the Query builder to set the sort order.
Hej
September 15, 2019, 1:03pm
3
There’s an event.orderby parameter in there already
I’d already tried adding the sort by like in your post but if breaks the data grid-it never loads any data
And if I do exactly like in your post it breaks the ‘allow sorting’ property/functionality
enchev
September 16, 2019, 8:33am
4
You can combine default sort order with grid columns sorting using ${event.orderby}
expression in query builder:
Look for exceptions in Radzen output pane if the grid is not loading data.
Hej
September 16, 2019, 1:06pm
5
the api is throwing a 400 error because the orderby= query passed to it includes a comma
http://localhost:5000/odata/pushscrapeDB/Results?$top=25&$skip=0&$orderby=ResultKey%20desc,&$count=true
The query specified in the URI is not valid. Expression expected at position 15 in 'ResultKey desc,'
im on version 2.21.1
seems like the ${event.orderby} is null at the start & it creates a malformed request?
enchev
September 16, 2019, 2:06pm
6
Yep, sorry my mistake. You can actually create the following expression:
${event.orderby || 'ProductName desc'}
This will sort initially the grid by ProductName descending and first column sorting will overwrite it:
1 Like
Moo
April 28, 2020, 10:29am
7
Would it be possible to make that textbox longer?
Would be nice being able to read what has been put in there on first sight.