I. Overview
1.1 Requirement
When performing data entry in a particular project, we might have to jump to a child window by clicking a button to fill in details and expect the parent window to be refreshed upon closing the child window after data entry has been completed. How can we make settings so that the parent window is refreshed when the child window is closed?
1.2 Solution
In the process of data entry, when we link to a subreport, the previous page can be reloaded and refreshed by adding a Loading End event in Data Entry Settings.
Two methods are available:
1) Refresh the parent window through window.opener.location.reload() when quitting the child window.
2) Trigger an onunload event when we quit the page.
A combination of the two events can enable the effect we want.
II. Sample
2.1 Create a new parent window
1) Create a new parent window and add a dataset ds1:
SELECT * FROM userinfo
The design interface is shown below:
2.2 Create a new child data entry window
1) The design interface of the child data entry window is shown below:
2) Set data entry attributes:
Click [Template]>[Web Attributes]>[Data Entry Settings] and click Event Settings to add a Loading End event.
Input the following JS codes:
window.onunload = function(){ this.opener.location.reload(); }
2.3 Link the parent window and the child window
Add a hyperlink to the cell A1 in the parent window and select the type as Web Report.
The child window is the target report to be opened (a relative path is used in the figure below, and the parent and child windows should be placed in the same directory) and the link is opened in a new window, which passes a parameter op.
2.4 Preview
Save the template and click [Data Entry Preview]. The effect is shown in the figure below: