TObjectDataSet - new record is not current after post

Issue #268 on hold
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 (4)

  1. Stefan Glienke repo owner

    Sorting and filtering is currently hopelessly broken and fixing that is honestly very low on my priority list.

  2. Log in to comment