Overview
Expected Effect
Example one: refresh after successful data entry, as shown in the following figure
Example two: refresh by button clicking, as shown in the following figure
Implementation Method
You can refresh a page by location.reload() or _g().refreshAllSheets(). The following table introduces the difference between the two APIs.
location.reload() | _g().refreshAllSheets() |
---|---|
|
|
Example One: Refresh After Successful Data Entry
Data Preparation
Create a general report and create a dataset ds1 with the SQL statement SELECT * FROM EMPLOYEE.
Table Design
Design the table as shown in the following figure. For details about procedures, see Free Report Data Entry.
Event Adding
Choose Template > Web Attribute > Data Entry Setting on the menu bar, select Set for This Template Separately in Following Settings, and add a Data Entry Successful event in Event Setting, as shown in the following figure.
The JavaScript code is as follows:
setTimeout(function() {
_g().refreshAllSheets();
//location.reload();
}, 500)
Effect Display
1. PC
Save the report and click Data Entry Preview. The following figure shows the refresh effect after successful data entry.
2. Mobile Terminal
Example Two: Refresh by Button Clicking
Template Preparation
Event Adding
1. Enter the parameter panel, drag a button widget into the panel, and modify the name of the button to Refresh, as shown in the following figure.
2. Select the button widget and add a click event, as shown in the following figure.
The JavaScript code is as follows:
setTimeout(function() {
//_g().refreshAllSheets();
location.reload();
}, 500)
Effect Display

Save the template and click Data Entry Preview. The following figure shows the refresh effect.
Template Download
For details, you can download the template Refresh After Successful Data Entry.cpt.
For details, you can download the template Refresh by Button Clicking.cpt.