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

Getting cell values for selected rows client side

2 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 26 Sep 2008, 05:42 AM
I read this topic below:

http://www.telerik.com/help/aspnet-ajax/grdgettingcellvaluesforselectedrowsclientside.html

But my scenario is like this:
1.> I have 3-level heirarchy.
2.> In my client-side script, it is possible for a user to select a row that belongs to any heirarchy
3.> What I want to retrieve is a value on one of the fields from the 1st level of the hierarchy

The code sample on the link works fine if I select a row that belongs to the 1st level of the grid itself. If I select the second and third levels, wrong values are retrieved.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Sep 2008, 07:23 AM
Hello Eric,

You can try out the following code to get the cell text when you select a row in a hierarchy.
js:
    function RowSelected(sender, eventArgs) 
    {  
     var dataItem = $get(eventArgs.get_id());    
     var rows =eventArgs.get_tableView().get_selectedItems();    
     for (var i = 0; i < rows.length; i++) 
      { 
        var row = rows[i]; 
        var masterCell = eventArgs.get_tableView().getCellByColumnUniqueName(row, "ColumnUniqueName"); 
      
       alert(masterCell.innerHTML); 
     } 

Thanks
Princy.
0
Eric
Top achievements
Rank 1
answered on 26 Sep 2008, 12:35 PM
This doesn't work for me as this code snippet seems to be designed as an event handler.

My problem is, after a user selects rows in any level of the hierarchy, i want to be able to get the value of one of the fields from the 1st level of the hierarchy where they belong to
Tags
Grid
Asked by
Eric
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Eric
Top achievements
Rank 1
Share this question
or