Hi.
Is there anywhere an example how to do updates of the items with a paged db query in OnManualLoadNextBuffer and OnManualLoadPreviousBuffer?
Best regards
Roland
We have recently improved this behavior. This improvement will be available in the next release.
In the next release you will be able to use the manual buffer loading in the following way:
procedure TForm1.TMSFMXTableView1ManualLoadNextBuffer(Sender: TObject);
begin
TMSFMXTableView1.LoadNextBuffer(20);
end;
procedure TForm1.TMSFMXTableView1ManualLoadPreviousBuffer(Sender: TObject);
begin
TMSFMXTableView1.LoadPreviousBuffer(20);
end;
The above code will load the next 20 items, or when scrolling back load the previous 20 items. You can change the number, or leave it empty to use the default buffer. Please note that this should also work when the TTMSFMXTableView has LiveBindings enabled. It has already added all items to the TableView. The manual buffer loading is not directly linked to the dataset.
Kind Regards,
Pieter
Hi - thanks for the fast response.
According to the documentation this should already be possible - but my experience was that it did not work as expected.
Anyhow I do not understand where would be the correct place to put my paged query and add the queried elements to the item collection.
Would I do that in front of TMSFMXTableView1.LoadNextBuffer(20);/TMSFMXTableView1.LoadPreviousBuffer(20);
If so would I only provide the exact 20 items of the next or previous page or more?
I have this code at the moment (using Aurelius) and it is not working as expected ...
procedure TfrPhysis.tvPhysisOverviewManualLoadNextBuffer(Sender: TObject);
var
bmel: TList<TMyQueryClass>;
bsme: TDiaBloodSugarMeasureEvent;
I: Integer;
it: TTMSFMXTableViewItem;
begin
bmel := OM.Find<TMyQueryClass>.OrderBy('EventDate', false)
.Skip(PageIndex * PageSize).Take(PageSize).List;
tvPhysisOverview.BeginUpdate;
for I := 0 to bmel.Count - 1 do
begin
bsme := bmel.Items;
it := tvPhysisOverview.Items.Add;
it.Caption := DateTimeToStr(bsme.EventDate);
it.Description :=
GetmyClassItemDescription(bsme);
it.DataObject := bsme;
it.CanDelete := true;
it.DetailView := pnBloodsugarMeasureDetail;
end;
tvPhysisOverview.EndUpdate;
tvPhysisOverview.LoadNExtBuffer(PageSize);
bmel.Free;
Inc(FPageIndex);
end;
procedure TfrPhysis.tvPhysisOverviewManualLoadPreviousBuffer(Sender: TObject);
begin
tvPhysisOverview.LoadPreviousBuffer(20);
Dec(FPageIndex);
end;
When will the next release be available?
Hi,
It's unclear when the next release will be available. We are currently implementing some improvements to existing components and the release needs to wait for these improvements. You can request an incremental source update for testing purposes through email.
Kind Regards,
Pieter