Atozed Forums
IwGrid + HTML Template + Async event = Position Problem - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: IwGrid + HTML Template + Async event = Position Problem (/thread-2512.html)



IwGrid + HTML Template + Async event = Position Problem - RobertoT - 09-18-2021

Buongiorno a tutti,


I have a problem with the IWGRID after an onAsync event : it loses its position. 

Let me explain : The IWGRID (yellow)  is placed in an HTML Template and its position is at the top of the page.

[attachment=415]

When I load the data into the grid through an Async event (eg IWButtonAsyncClick) the IWGRID moves to the foot of the page. 

[attachment=416]

I use the IWGRID.refresh command to bring up the updated data.
When I press F5 the IWGRID it positions itself correctly.

When I use an OnClick event to load data into cells, IWGRID always positions itself correctly

[attachment=417]

If I don't use the HTML template it works fine.

I have made several attempts, but I do not understand if I am making a mistake or if there is a problem in the Intraweb

I am attaching photos and a sample project.

Delphi 10.1 - Intraweb 15.2.37

Thanks in advance.


RE: IwGrid + HTML Template + Async event = Position Problem - Alexandre Machado - 09-28-2021

I'll have a look and get back to you.


RE: IwGrid + HTML Template + Async event = Position Problem - Alexandre Machado - 09-28-2021

This one is simple... You need a container for your IWGrid (the same is true for other controls as well) that will be rendered in async mode.

In your template your IWGrid is parented to the BODY of the HTML page. So, when the grid is re-rendered in async mode it's just added to the body, however, once there is no parent element (a DIV, for instance) it will be displayed at the bottom of the page.

To fix that, just add a <div> element as the grid container. Example:

<div id=gridContainer>
{%IWGRID1%}
</div>

Please, see the attached project. 

It will work as expected.

Cheers,


RE: IwGrid + HTML Template + Async event = Position Problem - RobertoT - 09-28-2021

(09-28-2021, 09:08 AM)Alexandre Machado Wrote: This one is simple... You need a container for your IWGrid (the same is true for other controls as well) that will be rendered in async mode.

In your template your IWGrid is parented to the BODY of the HTML page. So, when the grid is re-rendered in async mode it's just added to the body, however, once there is no parent element (a DIV, for instance) it will be displayed at the bottom of the page.

To fix that, just add a <div> element as the grid container. Example:

<div id=gridContainer>
{%IWGRID1%}
</div>

Please, see the attached project. 

It will work as expected.

Cheers,


Great ! It works perfectly. 

Thanks for the instructions, they were very helpful.

Bye