How Row and Record are different ?

Hello,

I want to know the difference between Row Index and Record Index of a SFDataGrid. I was trying to fetch a cell value of a specific row & column. While searching the forum I found that a similar issue has been raised earlier by a user and has been resolved already but the code provided for fetching a specific cell value is a bit confusing to me.

Below is the line of code I'm confused about:
var recordIndex = sfDataGrid.TableControl.ResolveToRecordIndex(rowIndex); 

What exactly this method "ResolveToRecordIndex(rowIndex);" is doing? Why are we resolving a row into a record? aren't they same and if they are not what is the difference?

Further why there is any need of getting MappingName of a column to fetch a cell value? isn't a column index is enough for it?

Lastly, is there any straightforward method to extract a cell value by supplying the row and column index of the cell?

Thank you


2 Replies 1 reply marked as answer

SG shankul gupta December 25, 2020 07:30 AM UTC

I guess this method ResolveToRecordIndex() is changing/resolving the requested row value (in our sense) to index value of that row inside the sfDataGrid as it starts counting from 0. so basically it is subtracting 1 from the specified row value so that outcome don't get changed due to a different number.

Please let me know If I'm right?

Thank you


FP Farjana Parveen Ayubb Syncfusion Team December 28, 2020 09:01 AM UTC

Hi Shankul, 
 
Thank you for using Syncfusion controls.  
 
What exactly this method "ResolveToRecordIndex(rowIndex);" is doing? Why are we resolving a row into a record? aren't they same and if they are not what is the difference? 
We have RowIndex and RecordIndex. RowIndex means its starts from StackedHeader to TableSummaryRow. We have lot of rows in SfDataGrid.StackedHeaderRow, HeaderRow,DefaultRow, UnboundRow, CaptionSummaryRow, GroupSummaryRow, TableSummaryRow, FilterRow, etc.,  
 
But RecordIndex is only for DefaultRow(RecordRow) alone 
 
 
Further why there is any need of getting MappingName of a column to fetch a cell value? isn't a column index is enough for it? 
Yes, you need a MappingName for get the cell value in SfDataGrid. If you get the CurrentCell value no need for MappingName, please refer the below UG link  
If you get the cell value randomly for any one of a row and column you need a MappingName, please refer the below UG link  
 
Lastly, is there any straightforward method to extract a cell value by supplying the row and column index of the cell? 
 
SfDataGrid is data bounded. So, SfDataGrid doesn’t have the support to get the cell value by using Row and Column index. You can achieve your requirement to get the cell value for a particular row and column by getting the ItemPropertiesProvider in SfDataGrid.View. Please refer the below UG link, 
 
 
 
 
 
Please let us know if you need any further details on this. 
 
Regards, 
Farjana Parveen A 


Marked as answer
Loader.
Up arrow icon