CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

How to check an Ajax call

General discussion

by Davide » 17 Jun 2014 16:31

Hello,

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
Davide
 
Posts: 150
Joined: 14 Oct 2013 11:33

by Alexander Bulei » 17 Jun 2014 16:51

Hi Davide,

You have several ways to do it:


  • Check the InAjaxReRender (declared in IWCGJQMCommon)
  • Add new parameter to your procedure, something like this:

    delphi code
    FillVisitList(AVisitList: TObjectList; const AOnCreate: Boolean);


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests

Contact Us.