Web Core Continuous Scroll OnFetchNextPage vs CreateForm


The OnFetchNextPage event of the Continuous Scroll component works before the OnCreate event of the form, is this normal? I got a case where I need to show data according to a certain condition.

Assume I got two forms. The first form contains two buttons, the second form contains a continuous scroll. The user ends up in the second form if either one of the buttons is clicked. According to the button that is clicked, I have to load the continuous scroll with a particular ItemTemplate. I can't feed the ItemTemplate in the OnCreate event of the second form, because the OnFetchNextPage event reacts quicker. What I do now is just feed the ItemTemplate in the OnFetchNextPage event. But because this event can be triggered so many times, I fear that this will result in unnecessary performance drops.

Is this the right way to do it, or is there another way?

Kind Regards.


Have you tried setting TWebContinuousScroll.AutoLoadFirstPage to False? This will prevent the automatic first fetch to trigger. Then in the OnCreate event you could do something similar to:

procedure TForm1.MiletusFormCreate(Sender: TObject);
  WebContinuousScroll1.ItemTemplate := 'my template';