This is a migrated thread and some comments may be shown as answers.
Selected Row after Reload?
11 Answers 217 Views
This is a migrated thread and some comments may be shown as answers.
Robert Madrian
Top achievements
Rank 1
Robert Madrian asked on 14 Nov 2016, 02:39 PM

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

Sort by
0
Kiril Nikolov
Telerik team
answered on 15 Nov 2016, 08:52 AM
Hello,

You can use the dataBound event and select the row with the select method.

Regards,
Kiril Nikolov
Telerik by Progress
 
Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
 
0
Robert Madrian
Top achievements
Rank 1
answered on 15 Nov 2016, 09:01 AM

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

 

0
Kiril Nikolov
Telerik team
answered on 15 Nov 2016, 11:33 AM
Hi,

Check the following example:

http://dojo.telerik.com/UcojU

Regards,
Kiril Nikolov
Telerik by Progress
 
Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
 
0
Robert Madrian
Top achievements
Rank 1
answered on 15 Nov 2016, 04:05 PM
Hi Kiril,
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
0
Robert Madrian
Top achievements
Rank 1
answered on 15 Nov 2016, 04:21 PM

found it

var grid = $("#grdFachgruppenzugehörigkeit").data("kendoGrid");
var row = grid.select();
grid.dataSource.read();
grid.select(row);
0
Robert Madrian
Top achievements
Rank 1
answered on 15 Nov 2016, 04:38 PM
sorry for the last post - after testing this dosn't work :-(
0
Kiril Nikolov
Telerik team
answered on 16 Nov 2016, 08:25 AM
Hi,

If you have single selection, then persists just the single item:

http://dojo.telerik.com/UcojU/5

Regards,
Kiril Nikolov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Robert Madrian
Top achievements
Rank 1
answered on 16 Nov 2016, 11:14 AM

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

0
Accepted
Kiril Nikolov
Telerik team
answered on 16 Nov 2016, 01:32 PM
Hi,

Just use any unique field from the model, to persist the item.

Regards,
Kiril Nikolov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jairo
Top achievements
Rank 1
answered on 20 Feb 2021, 04:05 PM
Good day this same case in kendo grid MVC, how would it be?
0
Anton Mironov
Telerik team
answered on 23 Feb 2021, 01:10 PM

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/.

Tags
Grid
Asked by
Robert Madrian
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Robert Madrian
Top achievements
Rank 1
Jairo
Top achievements
Rank 1
Anton Mironov
Telerik team
Share this question
or