Browse Source

* Fix position after Insert

michael 7 years ago
parent
commit
9e086a3de8
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/fcl-db/jsondataset.pas

+ 3 - 2
packages/fcl-db/jsondataset.pas

@@ -275,7 +275,8 @@ end;
 function TDefaultJSONIndex.Insert(aCurrentIndex, aRecordIndex: Integer
 function TDefaultJSONIndex.Insert(aCurrentIndex, aRecordIndex: Integer
   ): Integer;
   ): Integer;
 begin
 begin
-  Result:=inherited Insert(aCurrentIndex, aRecordIndex);
+  FList.splice(aCurrentIndex, 0, aRecordIndex);
+  Result:=aCurrentIndex;
 end;
 end;
 
 
 function TDefaultJSONIndex.FindRecord(aRecordIndex: Integer): Integer;
 function TDefaultJSONIndex.FindRecord(aRecordIndex: Integer): Integer;
@@ -653,7 +654,7 @@ begin
       end
       end
     else  // insert
     else  // insert
       begin
       begin
-      FDefaultIndex.Insert(FCurrent,Idx);
+      FCurrent:=FDefaultIndex.Insert(FCurrent,Idx);
       // Must replace this by updating all indexes.
       // Must replace this by updating all indexes.
       // Note that this will change current index.
       // Note that this will change current index.
       if (FCurrentIndex<>FDefaultIndex) then
       if (FCurrentIndex<>FDefaultIndex) then