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 { get; set; }
public List<double> SelectedIndexes = new List<double>();
public List<Order> Orders { get; set; }
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.