This is a migrated thread and some comments may be shown as answers.

Grid Selectkeyname is not getting correct value

1 Answer 739 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suman
Top achievements
Rank 1
Suman asked on 27 Sep 2017, 04:40 AM

Hi,

In button click event inside the script will call $("#grd").data("kendoGrid").dataSource.read(); 

script for Grid databound

function onDefaultSelect(e) {
    
    var rows = e.sender.tbody[0].rows;
    $(rows).each(function (e) {
        var grid = $("#grd").data("kendoGrid");
        var row = this;
        var dataItem = grid.dataItem(row);        
        grid.select(row);
    });    
    var getValue = this.selectedKeyNames().join(",");
}

When I button click  the selectedKeyName value is getting correct. When I button click again, the selectedkeyvalue is not changed, it getting old value. Is there any missing script ??

Regards

Suman

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 28 Sep 2017, 10:55 AM
Hello, Suman,

The selectedKeyNames method will return the ids of the selected rows in the Grid and in the following code should select programmatically all of them. The value should change only if the items are changed:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-selectedKeyNames

Please advise if, after the second click, the items and especially the Ids are changed, if not then it is expected to have the same values.

Regards,
Stefan
Progress Telerik
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.
Tags
Grid
Asked by
Suman
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or