Selecting row programtically on grid with inital sorting.

Hello,

I am developing a Blazor Server App and came across the following issue. 

I created a page that loads data from a database into a local list and then binds  the grid. The grid is configured with Sort Settings:

<GridSortSettings>
    <GridSortColumns>
        <GridSortColumn Field="@nameof(Record.RecordNumber)" />
    </GridSortColumns>
</GridSortSettings>

So far so good. Now I want to select a specific row programmatically. However, using GetRowIndexByPrimaryKeyAsync gives me the index in the original (unsorted) data, not the index of the row after the data is sorted. 

Is there a solution to this problem. I tried to select the row in various lifeycycle stages of the pages but always having the same problem. 

Any help would be appreciated. 

Thank you

Sascha



1 Reply

SK Sanjay Kumar Suresh Syncfusion Team March 28, 2025 08:34 AM UTC

Hi Sascha Stops,


We have created a simple sample that performs initial sorting in the Grid. After sorting, we accessed the row index using the primary key values and verified that the correct row index is returned. The row index is retrieved based on the sorted order of the rows. For your reference, we have attached the tested sample. Please check it from your end and let us know if you need any further assistance.


Concern Playground Sample:

https://blazorplayground.syncfusion.com/embed/rXLytqhbLvZXfvcU?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5


If the reported issue still reproduced, then kindly share the below details to validate further at our end.


  1. Please provide a simple issue replicating sample or try to modify the above-mentioned sample.
  2. Share us the video demonstration of the reported issue.
  3. Share us the NuGet version you are facing the issue.


The above requested detail will be very helpful for us to validate the reported issue at our end.


Regards,

Sanjay Kumar Suresh


Loader.
Up arrow icon