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

Selected rows in a grid grouped by two columns

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Julia Shah
Top achievements
Rank 1
Julia Shah asked on 09 Dec 2008, 11:25 PM

Hi,

I am using following code to get all the rows (checkboxes) that have been selected by a user:

 

 

function GetSelectedRows()  
// get all the rows with the checkbox checked  
    var strTickets = "";  
    var grid = window["<%= RadGrid1.ClientID %>"];  
    var masterTableView = grid.MasterTableView;  
      
    for (var i=0; i<masterTableView.Rows.length; i++)  
    {              
        var cell = masterTableView.GetCellByColumnUniqueName(masterTableView.Rows[i] , "TemplateEditColumn");  
        alert("cell=" + cell);  
        var checkBox = cell.getElementsByTagName("INPUT")[0];  
        if (checkBox && checkBox.checked)  
        {  
            var cellID = grid.MasterTableView.GetCellByColumnUniqueName(masterTableView.Rows[i], "TradeTicketID");  
            strTickets = strTickets + cellID.innerHTML + ",";  
        }  
    }  
 
    return strTickets;  
      

 

Everything works fine when there is no grouping, or if the grid is grouped by one column. But when I group by two columns, it doesn't work. It fails on alert("cell=" + cell) with "cell=undefined". Any ideas?

We are using RadGrid v2.0.50727, this project was developed last year.

Thank you,
Julia

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 10 Dec 2008, 06:59 PM
Hello Julia,

For such scenarios I recommend you another approach. Please examine the example I created for your convenience. You can find it attached to this thread.

Best regards,
Daniel
the Telerik team

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