Overview
Version
| Report Server Version |
|---|
11.0 |
Expected Effect
You hope that data can be automatically refreshed when you switch between sheets after data entry, as shown in the following figure.

Implementation Method
You can use the _g().parameterCommit() API for automatic data refresh after switching to other sheets.
Example
Report Design
(1) Create a general report and create a dataset ds1 with the SQL statement SELECT * FROM Orders_new.
(2) Add a template parameter and name it ID, as shown in the following figure.

(3) Bind this parameter to a widget on the parameter panel: Add the parameter as a widget on the Widget Setting panel, select Drop-down Box Widget from the
drop-down box, and set a data dictionary for the widget, with Actual Value and Display Value set to the CustomerID field in the Orders_new table, as shown in the following figure.

sheet1 Preparation
(1) Design the table in sheet1: Drag the fields from ds1 into the corresponding cells, add date widgets to cells B2 and E2, and add text widgets to cells C2 and D2, as shown in the following figure.

(2) Double-click cell A2 and add a data filtering condition that binds the cell to the template parameter to enable parameter query, as shown in the following figure.

(3) Set data entry attributes for sheet1, as shown in the following figure.

sheet2 Preparation
(1) Click the
icon in the lower left of the designer to add sheet2. Design the table in sheet2.

(2) Double-click cell A2 and add a data filtering condition that binds the cell to the template parameter to enable parameter query, as shown in the following figure.

JS Code Adding
Click the
icon on the parameter panel, select the drop-down box widget, and add an After Editing event for it, as shown in the following figure.

The JS code is as follows:
$(".fr-sheetbutton-container").click(function() //When switching between sheets
{
_g().parameterCommit()
});
Effect Display
The effect on the PC is the same as that shown in the section "Expected Effect."
Note:Template Download
Download the template by clicking Refreshing Data upon Sheet Switching by JS.cpt.