The business logic in my MVC project only allow user selecting
two rows. I tried couple of ways but no success solution yet. Does anyone have
idea about this ?
Thanks.
1 Answer, 1 is accepted
0
Georgi
Telerik team
answered on 13 Feb 2019, 01:12 PM
Hello Daochuen,
A possible solution would be to attach a click handler to the row and check for the count of the selected rows. If there are already two rows selected prevent the user from selecting another one.
e.g.
$('#grid tbody tr').on('click', function (e) {
var grid = $('#grid').data('kendoGrid');
debugger
if (grid.select().length >= 2 && !$(e.currentTarget).is('.k-state-selected')) {
e.preventDefault();
e.stopPropagation();
}
})
Below you will find a small sample which demonstrates the above approach:
Even though the sample uses a jQuery grid, as the logic is on the client, the very same approach applies for a grid configured with the server wrappers.
Regards,
Georgi
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.