CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

RenderAsync

General discussion

by etwoss » 22 Apr 2014 12:52

Hi

Can you explain what it does?

Code: Select all
  RenderAsync:= CGIsCallBackProcessing;
  try
     .
     .
  finally
    if RenderAsync then
    begin
      CGCallBackEnableAjaxResponse;
      RenderRegionAsync(Parent as TIWHTMLContainer);
    end;
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 22 Apr 2014 23:50

Hello

By default, in an ajax / async event CGIsCallbackProcessing = True (async it's just a property of ajax thats why i call it ajax events, callback is also an Intraweb term for ajax events).

the iw controls and cgcontrols translate the properties that you change and the methods you call to javascript, to be executed when the ajax event backs to browser.

Not all properties changes or methods supports this javascript generation. The best method would be checking browser console, because we had to revise all of our documentation, and for each property and method, inform what is supported or not in ajax.

Now, since RenderRegionAsync (or method .AjaxReRender) is a full re-renderization of the html and script of the respective control / region,

ti doesn't make sense to fill the javascript stack with unuseful code, since the whole control html and script is going to be re-render, its a waste of processement and bytes to download server-client.

That's why we use CGDisableCallbackResponse and CGEnableCallbackResponse pair.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 26 Apr 2014 14:42

Hi!
Thanks for answer, but can you explain on sample?
For example, we have form and two regions with two edits on each region.

Form
- Region1
-- Edit1
-- Edit2
- Region2
-- Edit3
-- Edit4

1. Let's think, that we need to change Region2 background. What is best way to do?
2. Let's think, that we need change Edit3 text. What is best way to do?
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 28 Apr 2014 09:51

Hi George

1. Let's think, that we need to change Region2 background. What is best way to do?


Presuming that to change Region2 background we need renderasync, it would be RenderRegionAsync(Region2) / Region2.AjaxReRender

2. Let's think, that we need change Edit3 text. What is best way to do?


Again. we don't need to use RenderAsyncRegion / AjaxReRender, to change the edit text, but if we needed it would be Edi3.AjaxReRender?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 28 Apr 2014 10:24

So, in this sample, there is no need to use CGDisableCallbackResponse/CGEnableCallbackResponse?
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 28 Apr 2014 10:33

Hi

Assuming that both changing the Region background or Edit text, wasn't supported in ajax events, ie, it didn't generate javascript to support changing the region background and edit text, there is no need to call

CGCallbackDisableResponse, because there was no response avaialble.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to General - Archive

cron

Who is online

Users browsing this forum: No registered users and 4 guests

Contact Us.