I use the following code in the OnCreate event of a Frame and on several VClick button events defined in the frame.
Is there a way to distinguish if the function is called by an Ajax event or if it is called by the OnCreate event ?
As you can see by the comment in the code I need to know in wich scenario the function is called to re render or not.
- Code: Select all
procedure THomeFrame.FillVisitList(AVisitList: TObjectList);
var
Visit: TVisit;
I: Integer;
begin
VisitsListView.Items.Clear;
if (Assigned(AVisitList)) then begin
for I := 0 to AVisitList.Count -1 do begin
Visit := TVisit(AVisitList[I]);
with (VisitsListView.Items.Add) do begin
Header := Visit.Customer.CustomerName;
HeaderASide := Visit.GetVisitTimeAsString;
Description := Visit.Reference;
Text := 'cdscascaca';
UserData := Visit;
Events.OnVClick.OnEvent := VisitListViewItemVClick;
end;
end;
end else begin
with (VisitsListView.Items.Add) do begin
Header := 'Nessuna visita';
end;
end;
// Here I need to check the funciont is called by the OnCreate or by an Ajax event
VisitsListView.AjaxReRender();
end;
Thank you,
Davide