I.Overview
1. Expected effect
1) Example 1: Data entry and refresh successfully
2) Example 2: Data verification refresh
2. Realization ideas
Refresh the current page through location.reload(), which is the same as manual refresh.
If the report has multiple pages, it will return to the first page after refreshing.
If the report has a parameter interface, refreshing is equivalent to reloading, and the parameter query results before refreshing are not retained.
Support mobile terminal refresh.
Refresh effect can be triggered wherever JavaScript can be used.
II. Example 1: Data entry and refresh successfully
1. Data preparation
Create a new general report, create a new dataset ds1, the SQL statement is: SELECT * FROM EMPLOYEE
2. Design report
Design the table as shown in the figure below, see for details: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\First_Form.cpt
3. Add event
Click Template>Web Attributes>Data Entry Settings, select individually set for the template, and add a "Data Entry Successful" event, as shown in the figure below:
The JavaScript code is as follows:
location.reload();
4. Preview effect
Save the template, click data entry preview, and the refresh effect after the template is completed is as shown in the I.1.1).
Note: Support mobile terminal.
III. Example 2: Data verification refresh
1. Data preparation
Create a new general report, create a new dataset ds1, the SQL statement is: SELECT * FROM Product order by ProductID limit 5
2. Design report
Design the table as shown in the figure below, see for details: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\RowForm\Simple_Row-based_Form.cpt
Note: A text field widget is inserted in all cells B3 ~ K3.
3. Add event
Click Template>Web Attributes>Data Entry Settings, select individually set for the template, and add an "After Validation" event, as shown in the figure below:
4. Preview effect
Save the template, click data entry preview, the refresh effect after data verification is shown in I.1.2).
Note: Support mobile terminal.
IV. Example 3: Click button to refresh
1. Data preparation
Create a new general report, create a new dataset ds1, the SQL query statement is:
SELECT * FROM STSCORE where 1 = 1
${if(len(classno)== 0 ,"","and classno ='" + classno + "'")}
Create a new dataset ds2, the SQL query statement is:
SELECT * FROM STSCORE where 1=1
${if(len(stuno)== 0 ,"","and studentno in('" + stuno + "')")}
2. Design report
1) Design the report as shown below:
2) Drag each field into the report, set cell B2 to expand horizontally, and customize the upper parent cell of cell A3 to A1, as shown in the following figure:
3) The design of the parameter pane is shown in the figure below:
3. Add event
1) Add a button widget in the parameter pane and change the widget name to "Refresh", as shown in the figure below:
2) Add a click event to the widget, as shown in the following figure:
4. Preview effect
Save the template, click data entry preview, click the refresh button, and the effect is as shown in I.1.3).
Note: Support mobile terminal.
V. Download templates
1. Example 1
Please refer to the completed template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\JS\jsApplications\Data_entry_and_refresh_successfully.cpt
Click to download: Data_entry_and_refresh_successfully.cpt
2. Example 2
Please refer to the completed template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\JS\jsApplications\Data_verification_refresh.cpt
Click to download: Data_verification_refresh.cpt
3. Example 3
Please refer to the completed template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\JS\jsApplications\Click_button_to_refresh.cpt
Click to download: Click_ button_to_refresh.cpt