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

Selectable column onSelect event

1 Answer 1807 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aliaksandr
Top achievements
Rank 1
Aliaksandr asked on 04 Jan 2018, 07:47 PM

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

1 Answer, 1 is accepted

Sort by
0
Eduardo Serra
Telerik team
answered on 05 Jan 2018, 08:56 PM
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.
Tags
Grid
Asked by
Aliaksandr
Top achievements
Rank 1
Answers by
Eduardo Serra
Telerik team
Share this question
or