We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid SelectedRows are lost

Thread ID:

Created:

Updated:

Platform:

Replies:

151260 Feb 5,2020 10:26 AM UTC Feb 6,2020 07:06 AM UTC Blazor 1
loading
Tags: Grid
ebi torabi
Asked On February 5, 2020 10:26 AM UTC

Please note the attached video.
my Grid is in one component that is called from another component

Attachment: GridLoseSelectedRows_f0474dea.zip

Vignesh Natarajan [Syncfusion]
Replied On February 6, 2020 07:06 AM UTC

Hi Ebi Torabi,  

Thanks for contacting Syncfusion support.  

Query: “my Grid is in one component that is called from another component 

By default Grid Selection cannot be persisted while destroying and re-rendering the component again. So we can achieve your requirement using GetSelectedRowIndexes() and SelectRows() method of EjsGrid. Refer the below code example.  

<EjsButton OnClick="Store">Save selection</EjsButton> 
<EjsButton OnClick="Load">Load selection</EjsButton> 
 
<EjsGrid @ref="Grid" DataSource="@Orders" AllowSelection="true" AllowSorting="true" AllowPaging="true">       
…. .. ..  
</EjsGrid> 
 
@code{ 
    EjsGrid<Order> Grid { getset; } 
    public List<double> SelectedIndexes = new List<double>();  
    public List<Order> Orders { getset; } 
    public async void Store() 
    { 
      SelectedIndexes = await Grid.GetSelectedRowIndexes(); 
    } 
    public async void Load() 
    { 
       await Grid.SelectRows(SelectedIndexes); 
    } 
. . . . .. . . . 
} 


Note: We have stored the selected index and applied the selected index using external button click. Similarly you can achieve your achieve your requirement by saving the selectedindexes while navigating to other page and apply the selection again to Grid using the stored the indexes again when Grid is rendered.   

Refer our API documentation for your reference 



Kindly get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon