TDBAdvGrid reselect row after sort

I have a TDBAdvGrid connected to a dataset (PageMode=false).  If I used the built in sorting, the currently selected data row does not follow the sort.  In other words, if I selected row three using the grid, then row three is still selected after a sort even though the data is now in row six.  I would like to be able to re-select the data row after the sort is completed, but since I do not see an AfterSort event, how do I re-select the data row that I want after the sort is completed?

Do I need to do the sort myself in the CanSort event?

Correction... The TDBAdvGrid is connected to a ClientDataSet,

The demo Demos\DBAdvGrid\CDSSort  shows two ways to sort. You need the dataset based sort (bottom grid) if you need to keep selection in the grid in sync.

Nevermind.  I went ahead and did it in the CanSort event since I also wanted to be able to re-select all the selected rows.  I just saved the IDs of each selected row, and re-selected them after I did the sort on the clientdataset by selecting a new index based on the column clicked on and toggling the sort direction.  Fairly simple.

Thanks.  I guess we both posted at the same time.  Hmmm.  I thought I install everything but don;t see any demos as being installed.  Will try to see what's up with that.

Demos are under Documents\tmssoftware

There is a link to this folder added in the Windows start menu