When refreshing the datasource of a grid, a common requirement is to retain the position of the selected record.
The datasource function refresh(true) was supposed to handle this, but does not always work. Also getPosition() and setPosition() will not provide this functionality.
One way to solve it is to use findRecord(Common _record). For this to work you will need to fetch the record from the database, as simply using the cursor() record will not suffice.
MyTable myTableCursor = MyTable_ds.cursor(); MyTable myTableLocal = MyTable::findRecId(myTableCursor.RecId); MyTable_ds.executeQuery(); if(myTableLocal) { MyTable_ds.findRecord(myTableLocal); }