Make "orderBy" public in RadzenGrid (or some way of setting the initial orderby status) #59

Open
opened 2026-01-29 17:30:54 +00:00 by claunia · 0 comments
Owner

Originally created by @javiercampos on GitHub (Mar 17, 2021).

Is your feature request related to a problem? Please describe.
I can't seem to set the initial state of the sorting on columns. In our "search" pages (where we use the grid, mainly), we store the "search model" where we save the current page, search form status, etc.

We'd like to also store the sorting on the grid (we use the LoadData event). However, there's an orderBy property from where the sorting state is stored, but it's private (it's also what the column header template queries to draw its icon), so we can't modify it.

You have the OrderBy and OrderByDescending methods which set the property, but they also set the current page to 0 (they set Skip to 0) and immediately request a reload... so setting the current page number and the sorting state doesn't seem to be possible without initiating several LoadData requests.

It's of course hackable if you know what you are doing (or we can just copy the source code and modify), but this should be able to be native to the component, in our oppinion.

Describe the solution you'd like
Either make orderBy public, or make it a [Parameter] property which can be set on initialization without necessarily invoking a reload (or set the page to first page).

Notice that if making it a parameter it would clash with the OrderBy method, so it should be named differently

If you need it, I offer myself to do the PR if needed, as long as you decide what we should call the public property (which again, can't be OrderBy because there's a method named like that)

Originally created by @javiercampos on GitHub (Mar 17, 2021). **Is your feature request related to a problem? Please describe.** I can't seem to set the initial state of the sorting on columns. In our "search" pages (where we use the grid, mainly), we store the "search model" where we save the current page, search form status, etc. We'd like to also store the sorting on the grid (we use the `LoadData` event). However, there's an `orderBy` property from where the sorting state is stored, but it's private (it's also what the column header template queries to draw its icon), so we can't modify it. You have the `OrderBy` and `OrderByDescending` methods which set the property, but they also set the current page to 0 (they set `Skip` to 0) and immediately request a reload... so setting the current page number and the sorting state doesn't seem to be possible without initiating several `LoadData` requests. It's of course hackable if you know what you are doing (or we can just copy the source code and modify), but this should be able to be native to the component, in our oppinion. **Describe the solution you'd like** Either make `orderBy` public, or make it a `[Parameter]` property which can be set on initialization without necessarily invoking a reload (or set the page to first page). Notice that if making it a parameter it would clash with the `OrderBy` method, so it should be named differently If you need it, I offer myself to do the PR if needed, as long as you decide what we should call the public property (which again, can't be `OrderBy` because there's a method named like that)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#59