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

[Solved] Disable deselect of selected grid row

3 Answers 1356 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sarvesh
Top achievements
Rank 1
Sarvesh asked on 05 Nov 2014, 09:20 AM
Hi,

Is it possible to prevent deselect of a selected grid row (Control key + Click). I want selection to work on click but don't want my users to be able to deselect the row.

Regards,
Sarvesh

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 06 Nov 2014, 12:01 PM
Hi Sarvesh,


This is not supported out of the box. You could implement a custom solution, for example disable the Grid selection and manually add the k-state-selected class to the rows, that are clicked. You will then be able to retrieve the selected rows by this class again.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Sarvesh
Top achievements
Rank 1
answered on 10 Nov 2014, 06:23 AM
Hi Dimiter, 

If I set selectable to false then I no longer receive the grids change event. Do I have to implement a custom row click event as well?

Regards,
Sarvesh
0
Dimiter Madjarov
Telerik team
answered on 10 Nov 2014, 08:49 AM
Hi Sarvesh,


Indeed this is the case. Here is a sample implementation:
$("#grid tbody").on("click", "tr[role='row']", function () {
    $(this).addClass("k-state-selected");
});

and then retrieve the rows by the class too.
var selected = $("#grid tbody").find("tr.k-state-selected");

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Sarvesh
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Sarvesh
Top achievements
Rank 1
Share this question
or