I. Overview
1. problem description
In some cases, the widget in the body component of the dashboard will trigger the query action immediately after entering the query parameters.
However, sometimes you want to set a query button just like the parameter pane of normal reports. Click the query button to trigger the query action, as shown in the figure below:
2. Solution
In the After editing event of the widget, use return false to prevent the original query effect, and then use gotopage in the query button to refresh the report block and achieve the passing parameter effect.
II. Example
1. Report design
1) When creating a new dashboard, the body component adopts absolute layout. As shown in the figure below, drag the label widget, drop-down check box widget, button widget, and report block into the design body to adjust the size and layout.
2) Select the drop-down check box widget, set the widget name to a, and define the data dictionary.
The custom data dictionary is also shown above.
3) Select the drop-down check box widget to add a After editing event. The JS code is as follows:
return false;
4) Select the button widget, rename it to query, and add a click event to the control. The JS code is as follows:
var a=_ g().getWidgetByName('a').getValue();
this.options.form .getWidgetByName("report0").gotoPage(1,"{a:'"+a+"'}",true);
5) Add formula split ($a, ',') to A1 cell of report block as shown in II.1.1).
2. Effect preview
Save the report and click pagination preview. The effect is as shown in the I.1 description.
Note: mobile terminal is not supported.
III. Template download
For completed templates, please refer to:
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Dashboard\DashboardQuery.frm
Click to download the template: