Bug in SelectedRow[] with sorting

selRows

hotmailRowSelect
Select Some Row
Sort by click column header
Show the rowIndex of selectedRow[] and rowSelect[].

selectedRow returns row-index that out of rowCount.

This Test Grid is coded in OnDoubleClick :

procedure TS6_2S.asg2DblClick(Sender: TObject);
var
i : integer;
begin
with asg2 do
begin
MouseActions.CheckAllCheck := true;
MouseActions.DisjunctRowSelect := true;
MouseActions.DisjunctRowSelectNoCtrl := true;
MouseActions.HotmailRowSelect := true;
MouseActions.RowSelect := true;
MouseActions.PreciseCheckBoxCheck := True;

   Navigation.MoveRowOnSort := true;

   Options := Options + [goRowSelect, goRangeSelect];

   RandomFill(false);
   for i := 0 to rowCount-1 do Ints[0, i] := i;

   ClearRowSelect;
   SortIndexes.Clear;
   SortSettings.Show := false;
   SortSettings.Show := true;
   SortSettings.IndexShow := true;
end;

end;

The ? button works with OnClick Codes:

procedure TS6_2S.btn_rsClick(Sender: TObject);
var
iCnt, r, i : integer;
sTmp : string;
begin
with asg2 do
begin
iCnt := asg2.SelectedRowCount;
edt_selectedRow.Text := '';
edt_rowSelect.Text := '';
sTmp := '';

 for i := 0 to iCnt -1 do begin
   r := SelectedRow[i];
   sTmp := sTmp + '['+intToStr(r)+'] ';
 end;
 edt_selectedRow.text := sTmp;

 sTmp := '';
 for i := 1 to asg2.RowCount-1 do
 begin
   if rowSelect[i] then sTmp := sTmp +  '['+intToStr(i)+'] ';
 end;
 edt_rowSelect.Text := sTmp;

end;

end;

We traced & solved this issue. The next update will address this.