|
<< Click to Display Table of Contents >> Navigation: Forum > IWDBGrid - (RefreshAsyncRender, DoRefreshControl) |
03-26-2023, 07:35 PM:
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
04-10-2023, 04:44 AM:
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