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

Disable selection for rows + additional issue

1 Answer 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 20 Aug 2008, 01:08 PM
Hello!

I managed to disable the selection for some rows according to this link:
http://www.telerik.com/community/code-library/submission/b311D-tmkbk.aspx

My Problem is the following:
When clicking the checkbox in the header (select all items) all items except the ones that are disabled are checked --> as expected.
The Problem: The Checkbox in the header does not stay checked.
That means that i cannot deselect all selected items.

Can you provide a solution for this problem.

thx in advance

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 25 Aug 2008, 09:25 AM
Hi Markus,

Thank you for the observation. You can explicitly check the select all checkbox in the Selecting event of the last data row in RadGrid. Simply modify your Selecting event in the following way:

function Selecting (sender, args)  
    var i = 0; 
    while(typeof(a[i]) != "undefined"
    { 
        if (a[i++] == args.get_itemIndexHierarchical()) 
        { 
            args.set_cancel(true); 
        } 
    } 
     
    var chkAll = sender.get_masterTableView().HeaderRow.cells[0].childNodes[0]; 
    var index = args.get_itemIndexHierarchical(); 
    var maxIndex = sender.get_masterTableView().get_dataItems().length-1 
     
    if(index == maxIndex) 
        chkAll.checked = true


Best wishes,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Markus
Top achievements
Rank 2
Answers by
Veli
Telerik team
Share this question
or