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

[Solved] Grid RowSelected eventArgs rowIndex

2 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 26 Mar 2008, 11:20 PM

Hi,

I am using a RowSelected javascript function on two seperate grid instances - on different pages and was just wondering why I would be getting two different base values from the following code:

function RowSelected(sender, eventArgs)  
{  
   var dataItem = $get(eventArgs.get_id());  
   var radGrid = sender;  
   var MasterTable = radGrid.get_masterTableView();  
   var cell = MasterTable.getCellByColumnUniqueName(sender.get_masterTableView().get_dataItems()[dataItem.rowIndex-1],
"ColUniqueName");  

In one instance the dataItem.rowIndex returns a base of 0, while in my other grid it returns a base index of 1. Is the base rowIndex dependant on a specific feature of the grid? 

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Mar 2008, 08:02 AM
Hi Michael,

Generally rowIndex is the index of the row in the entire TABLE element and this may vary with different grid settings. For example if you have filtering enabled on a non scrollable grid you will have one more item before the first data row. You can use sectionRowIndex instead.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael
Top achievements
Rank 1
answered on 27 Mar 2008, 11:11 PM
Hi Vlad,

Thanks for the quick and clear response.
 
Regards, Michael.

Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Michael
Top achievements
Rank 1
Share this question
or