Averroes
Averroes

Reputation: 4228

Delphi QuantumGrid GetSelectedRowIndex after sorting

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.

Upvotes: 1

Views: 5140

Answers (1)

Uli Gerhardt
Uli Gerhardt

Reputation: 14001

You have to distinguish between records and rows.

Maybe TableView.DataController.FocusedRecordIndex is what you want?

Upvotes: 2

Related Questions