Reputation: 2205
I have this settings for the grid:
@(Html.Kendo().Grid<RoTechnicianAssignmentOperationModel>()
.Name("Grid")
.
.
.Selectable()
)
I use this jQuery code to add disabled class to specific rows:
$("tr.disabledRows").addClass("k-state-disabled");
It only grays-out the row but it is still selectable. Is it possible to make specific rows of a Kendo Grid unselectable?
Upvotes: 2
Views: 6991
Reputation: 30975
Can you look on this fiddle : http://jsfiddle.net/LL3GN/658/
In it, you have an array of id we don't want to select. On rowChange function, you need just to remove the class that make selected effect. [line 11 to 22 fiddle js:]
var todeselect = new Array();
todeselect[0]='2';
todeselect[1]='3';
function checkline()
{
var id = $('.k-state-selected td').html();
if( jQuery.inArray(id, todeselect) >= 0 )
{
$('.k-state-selected').removeClass('k-state-selected k-state-selecting');
}
}
In the kendo grid construction, you call this function on the change event : [line 30 fiddle js]
change: checkline,
In this exemple, id is equal to 'td' because the id is in first column.
Upvotes: 3