CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Async rendering a JQMRegion

by Davide » 05 Mar 2014 10:12

Hello,

I would like to show a runtime created list of JQMLabel in a JQMRegion by clicikng a JQMButton.
Following is the code I'm testing (derived form the same I'm using in a IWCGJQuery application):
Code: Select all
         if (CGIsCallBackProcessing) then
            CGCallBackDisableAjaxResponse;

         for I := 0 to MyStringList.Count -1 do begin
            MyItem := TMyObject(MyStringList.Objects[I]);
            LblD := TIWCGJQMLabel.Create(Self);
            LblD.Parent := MyRegion;
            LblD.TabOrder := i;
            LblD.Text := MyItem.Text;
            LblD.Visible := true;
         end;

         if (WebApplication.CallBackProcessing) then
            CGCallBackEnableAjaxResponse;
         RenderRegionAsync(MyRegion);


The code is executed but the JQMLabel list is not shown.
Is it possible ?
What's wrong with what I am doing ?

Thank you,
Davide
Davide
 
Posts: 150
Joined: 14 Oct 2013 11:33

by Jorge Sousa » 05 Mar 2014 13:37

Hi

You cannot do this:

if (WebApplication.CallBackProcessing) then
CGCallBackEnableAjaxResponse;

after you call

if (CGIsCallBackProcessing) then
CGCallBackDisableAjaxResponse;

WebApplication.CallBackProcessing returns false

so you must use, instead, the method as it is in the demos:

var
IsAsync: Boolean;
begin
IsAsync:= WebApplication.CallBackProcessing;
if IsAsync then
CGCallBackDisableAjaxResponse;
try
{....}
finally
if IsAsync then
CGCallBackEnableAjaxResponse;
end;
RenderRegionAsync(MyRegion);
end;
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Davide » 05 Mar 2014 15:08

Hello,

I can't find the IWCGJQMobile demo from where you extract the code reported in your post...
What project is it ?

I tryied to implement your solution but the region isn't updated and it doesn't show the runtime created label.
The code execute without any error but without any results.

Following what I coded:
Code: Select all
            IsAsync := WebApplication.CallBackProcessing;
            if (IsAsync) then
               CGCallBackDisableAjaxResponse;

            try
            for I := 0 to MyLabelsList.Count -1 do begin
                  LblD := TIWCGJQMLabel.Create(Self);
                  LblD.Parent := MyRegion;
                  LblD.TabOrder := I;
                  LblD.Text := MyLabelsList[i];
               end;
            finally
               if IsAsync then
                  CGCallBackEnableAjaxResponse;
            end;
            RenderRegionAsync(MyRegion);
         end;


Do you have any suggestions to achieve the results I need ?

Thank you,
Davide
Davide
 
Posts: 150
Joined: 14 Oct 2013 11:33

by Jorge Sousa » 05 Mar 2014 15:15

The RenderAsync examples are in jQueryDemo and jQueryDemo_V2

You also forgot to set the Name

LblD := TIWCGJQMLabel.Create(Self);
LblD.Name:= 'SomeLabelName';
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQMRegion

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.