
Hi,
what's the best and easiest way to save the selected row, make a refresh/reload and select the row again?
var
grid = $(
"#grid"
).data(
"kendoGrid"
);
// here I want to save the selected row/id (in a variable?)
grid.dataSource.read();
// re-select the previous "saved" row
11 Answers, 1 is accepted
You can use the dataBound event and select the row with the select method.
Regards,
Kiril Nikolov
Telerik by Progress

Hi,
but how to do this - there are many postings with different Solutions how to select a row (uid, id...)?
if you look at my Code sample above, before the "read" I want to save the current selection, then make a reload , and then select
the previous saved selection...
robert
Check the following example:
http://dojo.telerik.com/UcojU
Regards,
Kiril Nikolov
Telerik by Progress

Thanks for your solution, but with that solution I have to loop through all items in every Change Event to save the selected item and also on the dataBound Event to (re)select the item (slow maybe a performance problem?).
In my grid I have only single selection; so is this the only possible solution or is there a for singe selection without Looping through all items?
robert

found it
var
grid = $(
"#grdFachgruppenzugehörigkeit"
).data(
"kendoGrid"
);
var
row = grid.select();
grid.dataSource.read();
grid.select(row);

If you have single selection, then persists just the single item:
http://dojo.telerik.com/UcojU/5
Regards,
Kiril Nikolov
Telerik by Progress

Hi, thanks for the Solutions...
this works with models which have a one Primary key (id) - is this not possible with Composite keys or is it necessary to build a single id in the model?
robert
Just use any unique field from the model, to persist the item.
Regards,
Kiril Nikolov
Telerik by Progress

Hello Jairo,
In order to achieve the desired behavior, I would recommend using the "persistSelection" property of the Kendo UI Grid. This approach will keep the selected row/s out of the box.
Give a try to the persistSelection property and let me know if this is the expected behavior.
Kind Regards,
Anton Mironov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.