Reload grid from sub form

I have a parent form and a sub form. Whenever I load a parent form, the function below was triggered and display data in the grid. This is fine.

On the parent form I have a button, whenever I click this button, a sub form will popup.
In the sub form I have another button, whenever I click this button, I want to reload the grid.
Is it possible to reload grid data (in parent form) from sub form? How do I do that?

function doOnLoad() 
{
	mygrid = new dhtmlXGridObject('dgridDataList');
	mygrid.setImagePath('dhtmlx/dhtmlxGrid/codebase/imgs/');
	mygrid.submitOnlyChanged(false);
	mygrid.setFieldName("{GRID_ID}_{ROW_INDEX}_{COLUMN_INDEX}");
	mygrid.init();
	mygrid.setSkin("dhx_skyblue")
	gridQString = "data_load.asp";
	mygrid.loadXML(gridQString);
}

I want to reload the grid
To reload the grid you can use:

mygrid.clearAll() mygrid.loar(url);

dhtmlx.com/docs/products/dht … fresh.html

I have tried your suggestion but still no success. This is my codes.

–parent form

–sub form
window.opener.document.getElementById(‘dgridDataList’).clearAll();
window.opener.document.getElementById(‘dgridDataList’).load(‘subformload.asp’);

Hi Support,
Anybody can assist me solving my problems? Any alternative way of doing it?

clearAll() and load(‘subformload.asp’) method must be called from dhtmlxGrid object.

window.opener.document.getElementById(‘dgridDataList’) will not return you dhtmlxGrid object.

You should use:

mygrid.clearAll();
mygrid.load(“url”);

<< You should use:
<< mygrid.clearAll();
<< mygrid.load(“url”);

I know I can use above method to reload grid in “PARENT FORM” (where I create, init and load xml), but my question is can I call mygrid.clearAll(); and mygrid.load(“url”); methods from “POPUP FORM”?

What is your popu up form is? Is it new window any html container on the same page?

This is my codes where I call the popup form from the parent form. If this approach is wrong, please advise me the correct way of doing it.

  1. “mygrid” variable must be defined as global at parent page
... f 2. at pop up window you can take reference to the dhtmlxGrid object from parent window with following code: window.opener.mygrid.clearAll();

Thank you very much Olga, it works now. :mrgreen: :smiley: