Selectable column onSelect event

2 posts, 0 answers
  1. Aliaksandr
    Aliaksandr avatar
    3 posts
    Member since:
    Sep 2010

    Posted 04 Jan 2018 Link to this post

    Hello

     

    I have grid with selectable columns

    grid = gridDiv.kendoGrid({
        dataSource: dataSource,
        columns: [
            {
                selectable: true,
                width: "50px",
            }
        ],
     
    });
     
    kendoGrid = grid.data("kendoGrid");

     

    Is there any event that triggers when select/unselect happens. I need to trigger some other events when selection is changing + set some properties on data item.  

     

    Thanks

  2. Eduardo Serra
    Admin
    Eduardo Serra avatar
    119 posts

    Posted 05 Jan 2018 Link to this post

    Hello Aliaksandr,

    When a row is selected in a Kendo UI Grid the change event of the API is triggered; you can read more about in our documentation here. To see this in action, take a look at the Events demo in the samples section of our website here.

    Once a selection has been made, you can get the dataItem that corresponds to the selected row like this:

    var grid = $("#usersGrid").data("kendoGrid");
    var selectedItem = grid.dataItem(grid.select());

    And finally, you can change the properties of the dataItem by using the set method or changing them directly, depending on your scenario:

    //changes will be reflected inmediatly in the grid due to data binding being triggered
    dataItem.set("ProductName","Kendo UI");
     
    or
     
    //changes won't be reflected in the grid
    dataItem.ProductName = "Kendo UI";

    Take a look at this sample in the Kendo UI Dojo demonstrating the first approach.

    I hope this helps!

    Regards,
    Eduardo Serra
    Progress Telerik
    Try our brand new, jQuery-free Angular 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