views:

992

answers:

1

I have D2006 and I am using DevExpress QuantumGrid 6 in a project. I am using it in unbound mode. I have several rows and I need to trigger an action when user select a row and click a button. That works fine when the grid is not sorted by user. I use this code to know the row the user has selected:

index := cxMainTable.DataController.GetSelectedRowIndex(0);
cxMainTable.DataController.Values[index, 0];

But when the user sort the grid by clicking in a column header, the index returned is right for the current order displayed but the values the second line returns is the value that you would expect if the grid was not sorted.

Thanks.

+2  A: 

You have to distinguish between records and rows.

Maybe TableView.DataController.FocusedRecordIndex is what you want?

Ulrich Gerhardt
Thanks! That solved my problem.
Averroes