Grid Selectkeyname is not getting correct value

2 posts, 0 answers
  1. Suman
    Suman avatar
    11 posts
    Member since:
    Mar 2017

    Posted 26 Sep 2017 Link to this post

    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

  2. Stefan
    Admin
    Stefan avatar
    2821 posts

    Posted 28 Sep 2017 Link to this post

    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.
Back to Top