Hi there,
My requirement is i have created a form similar to form "Copy all" in sales orders form. When i open that form it will show two grids one for sales header and another for respective sales lines and I have added two unbound checkbox controls "Header selected" & "Lines selected" on both header and lines grid for selecting of header and lines for further process.
1. If i mark "Header selected" then automatically sales lines related to that sales order should automatically get marked on "Lines selected"
2. If i mark another "Header selected" on sales header grid then the previous record "header selected" & "Lines selected" should get unmark and the new "Header selected" and "Lines selected" should mark
3. I achieved both the above functionalities by using edit methods to both check boxes and storing values in a maps
4. To unmark the previous selected record and mark the newly selected one, i have used "modified" method of "Header selected" checkbox on header
5. The issue that I'm facing is after previous record is unmarked I'm doing form refresh using "Task refresh" and I have written the code to mark new record but "the cursor is not staying at the newly marked record instead it moves to the last record in the grid as i have given form datasource property "Start position" as "Last".
6. I want to know how to set the cursor position on the newly marked record. Any help would be appreciated.
I have tried below ways to set the cursor position in modified method of "Header selected" check box control but not succeeded
1. int position;
position = SalesTable_ds.getPosition();
custom code to unmark previous record
super();
refresh using task refresh
SalesTable_ds.setPosition(position);
custom code to mark newly selected record on both header and lines
2. SalesTable salesTableLoc, tmpTable;
salesTableLoc = SalesTable_ds.cursor();
RecId recId = salesTableLoc.Recid
tmpTable = SalesTable::findRecId(tmpTable)
custom code to unmark previous record
super();
refresh using task refresh
SalesTable_ds.findRecord(tmpTable);
custom code to mark newly selected record on both header and lines