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

Make row unselectable

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
miksh
Top achievements
Rank 1
Iron
miksh asked on 23 Sep 2008, 12:48 PM
When using GridClientSelectColumn is there a way to make some row(s) unselectable which results in hiding a checkbox in this column and ignoring selecting by row click?

1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 23 Sep 2008, 02:53 PM
Hello Michael,

This is a possible approach:
<script type="text/javascript" language="javascript"
    var selectColumn = 0; 
 
    function SetDisabled(sender, rowNum) 
    { 
        sender.get_masterTableView().get_dataItems()[rowNum].get_element().cells[selectColumn].firstChild.disabled = true
    } 
 
    function GridCreated(sender, args) 
    { 
        SetDisabled(sender, 2); 
    } 
 
    function RowSelecting(sender, args) 
    { 
        var checkBox = sender.get_masterTableView().get_dataItems()[args.get_itemIndexHierarchical()].get_element().cells[selectColumn].firstChild; 
        if (checkBox.disabled) 
            args.set_cancel(true); 
    } 
</script> 

<ClientSettings Selecting-AllowRowSelect="true"
</ClientSettings> 
<ClientSettings ClientEvents-OnGridCreated="GridCreated" ClientEvents-OnRowSelecting="RowSelecting"
</ClientSettings> 

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Daniel
Telerik team
Share this question
or