Page 1 of 1

Problem with RenderRegionAsync

PostPosted: 30 Jul 2015 11:53
by Corwin
Hi

I have a frame with an object scheduler (see attachment)

pressing a button I create a report (IWCGJQButtonSalvaJQButtonOptionsClick).

I want to make a warning or a barprogress when creating the report.
In the method ReportProgress I try but the progress bar does not appear.
I tried it with a notification that I open the prim report.run, but not working.

both (progressbar and notification) appear only performing IWCGJQFileDownload.DownloadFileName (FileName);

What is wrong?

Regards.

Re: Problem with RenderRegionAsync

PostPosted: 30 Jul 2015 14:58
by Jorge Sousa
Hello

All you are doing in IWCGJQButtonSalvaJQButtonOptionsClick

it's always on server side, never goes to browser to do anything, all that you do with controls its going to generate javascript, that will be executed at once, when the event backs to browser.

You've to use IWTimer to update the controls.

Re: Problem with RenderRegionAsync

PostPosted: 30 Jul 2015 15:06
by Corwin
Hello Jorge

how should I use the timer? you have an example?

Regards.

Re: Problem with RenderRegionAsync

PostPosted: 30 Jul 2015 15:32
by Jorge Sousa
The TIWTImer is an Intraweb native control

you must see Intraweb examples.

Re: Problem with RenderRegionAsync

PostPosted: 05 Aug 2015 14:48
by Corwin
Hi Jorge
from another topic (problem Region async updater)

"by Jorge Sousa ยป 09 Jul 2013 13:16
Hi

Yes it's in server side, I remind you that you need to use RenderRegionAsync, only for things that aren't possible to do with normal properties change, for instance, clearing and adding items on a JQComboBox.

There is no such event, all you have to do is:

CGCallbackDisableAjaxResponse;
try
button1.enabled := false;
button2.enabled := false;
finally
CGCallbackEnableAjaxResponse;
end;
RenderRegionAsync(Region,False,True);

RenderRegionAsync, replaces the current browser region (and child controls) html by a new html, using jquery.

Best Regards

cgdevtools"


in attachment i simple project... button not works, so i have two TIWCGJQedit objects and in in onasyncexit method I tried to make a visible image as your example ... does not work ...

can you tell me what's the problem?

Regards.

Re: Problem with RenderRegionAsync

PostPosted: 05 Aug 2015 17:20
by Jorge Sousa
Hello

2 things

1 -
button not works


What do you mean, did you debug it and put a breakpoint there?

2-
I tried to make a visible image as your example ... does not work ...


Do you know what the Intraweb property RenderInvisibleControls: Boolean does?

Try to set IWFrameRegion.RenderInvisibleControls = True

(I know, this property should always be True, makes no sense to be False)

Re: Problem with RenderRegionAsync

PostPosted: 06 Aug 2015 08:32
by Corwin
Hi Jorge

1

obviously I tried debugging ... never enters functions click

2
Ok

Re: Problem with RenderRegionAsync

PostPosted: 06 Aug 2015 09:04
by Corwin
another question...

i have a iwregion in a TIWCGJQScheduler;
when I press a button, create a print; APrinting before I would bring up the region with the image, after the creation of the press make invisible the region with the image. The problem is that I see the region ONLY when the window appears to download ...

Code: Select all
procedure TCGIWJQSchedulerFrame.IWCGJQButtonSalvaJQButtonOptionsClick(
  Sender: TObject; AParams: TStringList);
begin
......
              if OraQuerySched.recordCount > 0 then
              begin
                XLSAdapter1.AllowOverwritingFiles := true;
                Report.FileName:=fileN;

 [b]               CGCallbackDisableAjaxResponse; 
                IWCGJQRegion2.Visible := True;  // Region with image
                IWImage1.Visible := True;             // Image in IWCGJQRegion2
                CGCallBackEnableAjaxResponse;
                RenderRegionAsync(IWCGJQRegion2,rramLazyLoadMethod,True);[/b]

                Report.Values['current_date'] := Now;
                Report.Run;  // create report
                info('Info --> Session  %s - Lanciata stampa Scadenziario ( %s ) Anno %s ',[UserSession.NrAppId , fileName, IWCGJQEditAnno.Text]);
                test := WebApplication.ApplicationPath + 'ExpPdf.exe ' + FileName + ' ' + FileNamePdf;
                //esito := ShellExecute(0, nil, PChar(WebApplication.ApplicationPath + 'ExpPdf.exe '),PChar(FileName + ' ' + FileNamePdf ), '', SW_HIDE);
                ExecuteAndWait(test);      // Converting EXCEL -> PDF
[b]                CGCallbackDisableAjaxResponse;
                IWImage1.Visible := False;
                IWCGJQRegion2.Visible := False;
                CGCallBackEnableAjaxResponse;
                RenderRegionAsync(IWCGJQRegion2,rramLazyLoadMethod,True);[/b]

                if FileExists(FileNamePdf) then
                   IWCGJQFileDownload.DownloadFileName(FileNamePdf)
                else
.....
end;


Some idea?

Regards

Re: Problem with RenderRegionAsync

PostPosted: 06 Aug 2015 09:40
by Jorge Sousa
Hello

Code: Select all
 [b]               CGCallbackDisableAjaxResponse; 
                IWCGJQRegion2.Visible := True;  // Region with image
                IWImage1.Visible := True;             // Image in IWCGJQRegion2
                CGCallBackEnableAjaxResponse;
                RenderRegionAsync(IWCGJQRegion2,rramLazyLoadMethod,True);[/b]


1- You don't need CGCallbackDisableAjaxResponse, CGCallBackEnableAjaxResponse and RenderRegionAsync for this.

2- use CGCallbackDisableAjaxResponse and CGCallbackDisableAjaxResponse it only when create new frames.
use RenderRegionAsync when the opearations envolved are not supported, which is not the case of IWCGJQRegion2.Visible:= True
When you use a control visibility change, make sure its parent has RenderInvisibleControls = True.

3- We told you before, when you call code like IWCGJQRegion2.Visible:= True, the server doesn't call the client to operate, for executing IWCGJQRegion2.Visible := False; after

all you are doing is adding javascript to be executed when the event returns to browser. In this case will set the javascript correspondant to

IWCGJQRegion2.Visible:= True and IWCGJQRegion2.Visible:= False at once, resulting in the invisibility.