Atozed Forums
IWDBGrid - (RefreshAsyncRender, DoRefreshControl) - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software (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: IWDBGrid - (RefreshAsyncRender, DoRefreshControl) (/thread-3095.html)



IWDBGrid - (RefreshAsyncRender, DoRefreshControl) - raulevm - 03-26-2023

Good afternoon, working with an example template, I try to asynchronously refresh an IWDBGrid control to see the changes of a DataSet. I have used the RefreshAsyncRender method and the IWDBGrid1.DoRefreshControl := True; property. I can see the changes to the DataSet but the control scrolls below all other controls. Even if I don't have any DataSet connected to the IWDBGrid the control changes position.

Initially:

{%IWBUTTON1%}
{%IWBUTTON2%}
{%IWDBGRID1%}
{%IWBUTTON3%}
{%IWBUTTON4%}


After applying the mentioned method and property:

{%IWBUTTON1%}
{%IWBUTTON2%}
{%IWBUTTON3%}
{%IWBUTTON4%}
{%IWDBGRID1%}

I attach an example project. If this is an IntraWeb failure, which of the two ways should I use to correctly refresh the IWDBGrid asynchronously? Thanks


RE: IWDBGrid - (RefreshAsyncRender, DoRefreshControl) - Alexandre Machado - 04-10-2023

If you are forcing a component to re-render in Async, like an IWGrid, please use the OnFindParentId event of the IWTemplateProcessorHTML component.

This is an example code of how it should be:

Code:
procedure TIWForm1.IWTemplateProcessorHTML1FindParentId(
  Sender: TIWTemplateProcessorHTML; AContainerContext: TIWContainerContext;
  const AComponent: TComponent; out AParentId: string);
begin
  if AComponent = MyIWGrid then
  begin
    AParentId := 'some_div';
  end;
end;

In this event you specify where the IWGrid should be inserted, i.e. what is the HTML element that should be the grid's immediate parent. You just need to provide a DOM Id of the HTML element (it doesn't even need to exist in your IntraWeb form)

Please let me know if ti works