I. Overview
1.1 Requirement
How to realize dynamic parameter hyperlinks in cells by a button click, as shown below:
II. Sample
2.1Sample 1: Dynamic parameter hyperlinks
2.1.1 Create a new decision-making report
Create a new decision-making report and add the dataset [ds1]:
2.1.2 Design the decision-making report
Add two button widgets in the [body] and name them East China and North China, respectively. Add a report block widget and drag the data fields of ds1 into cells. The template design interface is shown as below:
2.1.3 Add a click event
Select button0 widget of the East China button and add a click event. Add two parameters at the upper right corner of the click event, as shown below:
Parameter | Value |
session | sessionID |
region | East China |
Input the JS code:
$.ajax({
url: '/webroot/decision/view/form?op=fr_dialog&cmd=parameters_d',
type: 'POST',
data: {
"region": region
},
headers: {
sessionID: session
},
complete: function(res, status) {
if (window.FR && FR.Chart && FR.Chart.WebUtils) {
FR.Chart.WebUtils.clearCharts();
}
_g().loadContentPane();
}
});
Similarly, select the widget of the North China button, and add a click event. Add two parameters at the upper right corner of the click event, as shown below:
Save the template and preview the report.
2.2 Example 2: Report object hyperlinks
2.2.1 Create a decision-making report
Create a decision-making report and add the dataset [ds1]:
2.2.2 Design the decision-making report
Add two button widgets [button0] and [button1] in the [body] and name them Hyperlinks-Report and Hyperlinks-Chart, respectively.
Add a report block widget and a pie chart in the [body], and drag the data fields of ds1 into cells. The template design interface is shown as follows:
The pie chart is set as follows:
2.2.3 Add a click event
Select the button0 widget of Hyperlinks-Report button, add a click event, and input the Parameter: region and the String Value: North China at the upper right corner of the click event, as shown below:
Input the JS code:
_g().getWidgetByName('report0').gotoPage(1, {
"region": region
}, 'T');
Save the template and preview the report.