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

How to keep disabled rows from being selected by "Select All" checkbox?

1 Answer 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 20 Aug 2010, 03:10 PM
Any tips on how to handle this when using client side row selection?

Here's what I am trying to do now which is handling the OnRowSelecting event
to see if the row is disabled and canceling the selection if it is.

<script type="text/javascript">
    function RowSelecting(sender, eventArgs) {
         //Prevent "disabled" grid RowSelecting from being selected (individually)
         var grid = sender;
         var MasterTable = grid.get_masterTableView();
         var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
         if (row.disabled)
            eventArgs.set_cancel(true)
     }
 
</script>
<radG:RadGrid ID="RadGrid1" AllowMultiRowSelection="true" runat="server">
    <MasterTableView Width="100%">
        <Columns>
             <radG:GridClientSelectColumn UniqueName="ClientSelectColumn" />
         </Columns>
    </MasterTableView>
    <ClientSettings ApplyStylesOnClient="True">
         <Selecting AllowRowSelect="True"></Selecting>
         <ClientEvents OnRowSelecting="RowSelecting" />
     </ClientSettings>
</radG:RadGrid>


This works when individually trying to select a disabled row (prevents it), but when clicking the header row checkbox (to Select/DeSelect all) the disabled rows still get checked.

How can I prevent this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 24 Aug 2010, 08:23 AM
Hi Ron,

I have created a fully runnable project that handles the desired functionality. Please test it on your end and let me know if I'm missing something out.

I hope this helps.

All the best,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Ron
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or