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

grid.selectable=false Does not apply to grid.select() method

2 Answers 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Grant asked on 20 Jun 2019, 08:53 AM

Hi Team, 

To expand on my title, the default value of the 'selectable' attribute is false. However, by accident I discovered, that even if it is false, if you run the select() function on the grid, its default behavior is "multiple,row".

Is this the expected result in this scenario? Personally I would expect there to be no change as i have not specified a selection strategy?

See example, and comment out the selectable attribute: https://dojo.telerik.com/iyaFajoB

Regards, 

Grant

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 24 Jun 2019, 07:09 AM
Hi Grant,

When the select() method is called the k-state-selected class will be applied to the Grid row will be applied regardless of the selectable option because it is an API method. If you would like to prevent selection when selectable is set to false I suggests adding a condition that checks the value of the setting before calling select:


var grid = $("#grid").getKendoGrid();
if (grid.options.selectable) {
    grid.select("tbody tr:first-child"); 
}
 

Check out the dojo below that illustrates the approach:



Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 08 Jul 2019, 11:32 AM
Thanks for clarifying Viktor.
Tags
Grid
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Viktor Tachev
Telerik team
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or