TObjectDataSet - new record is not current after post

Issue #268 new
VlaPr
created an issue

When new record is added to the Sorted dataset, after post is not guaranted that the new records is current. Same thing migh happen after update as well.

The InternalSetSort may change the order of the items in the list. But at the end of the procedure the position is set to the original one (before sort).

The position has to be set to the actual position of the posted record (see the modification below)

procedure TObjectDataSet.DoPostRecord(Index: Integer; Append: Boolean);
begin

  if Sorted and sortNeeded then
    InternalSetSort(Sort, Index);

  // Locate correct position
  Index := IndexList.IndexOf(newItem);

  SetCurrent(Index);
end;

Comments (3)

  1. Log in to comment