XDataWebDataSet.AfterScroll event firing n times, one for each register on dataset - Version 1.9.8.3

Hello,
Version 1.9.8.3

the event XDataWebData.Set1AfterScroll is firing several times (one time for each register present in the dataset) and more, when you just navigate to any register of the dataset (first,next,previous, last, or any specific register).

For me, this event is crucial to use master-detail or to load an image from a blog field.

It is very simple to reproduce the situation:

drop a XDataWebDataSet1 + DataSource + XDataConnetion + NavBar + WebDBTableControl

connect to the xdata server...

You can use a Navigator bar and/or just use the event onClickCell of the WebDBTableControl

Create a OnClickCell

procedure TFormTesteA.WebDBTableControl1ClickCell(Sender: TObject; ACol,
ARow: Integer);
begin
writeln(DateTimeToStr(Now),': clicked ',Arow); // to see in browser console
if arow <> 0 // 0 is the header of the WebDbTableControl
then XDataWebDataSet1.RecNo := ARow; // select a specific clicked record
end;

procedure TFormTesteA.XDataWebDataSet1AfterScroll(DataSet: TDataSet);
begin
writeln(DateTimeToStr(Now),': AfterScrool ', XDataWebDataSet1.RecNo);
if XDataWebDataSet1.RecNo = LastRowReported // filter wrongs events
then loadImage( XDataWebDataSet1.RecNo ) ); // or show a detail record ...
LastRowReported := XDataWebDataSet1.RecNo; // save to the next AfterScroll event
end;

But this have a pattern behavior, and I am avoid this situation saving the current ROW of the
afterscroll event.
At next afterscroll event, test if the last Row is the same of the new Row,
if so, it is the true event AfterScroll and you can do the correct job, may be load an image from a blob or show an detail in other dataset.

Take a look using a DataSource.OnChange event, it may help you to run out of this situation:

  • just ignore all events: XDataWebDataSet1AfterScroll until that it occurs AFTER the DataSource.OnChange event. In this case, it is the useful XDataWebDataSet1AfterScroll.

For me that is working,

Any other sugetion ?

Thank you.

1 Like

any horizon for the correction of this problem?

A fix was applied that will be included in the next release.

1 Like