I. Overview
1.1 Requirement
In multi-sheet switch, users may feel difficult to select labels accurately, probably because there are too many sheet labels. Is there a simple way for users to select the exact sheets they wish to select?
As shown below, by clicking an option in the Radio Button Group widget, you can switch to the corresponding sheet:
1.2 Solution
This can be achieved by adding an event to a Radio Button Group widget using JavaScript.
II. Sample
2.1 Steps
1) Create a new workbook, generate 6 sheets, right-click on each sheet name, choose Rename and rename these sheets as apple, strawberry, orange, pear, blueberry and grape respectively.
2) Add a template parameter “rs”. In the parameter interface, add a Radio Button Group widget, bind it to the parameter and set Data Dictionary, with values set to apple, strawberry, orange, pear, blueberry and grape respectively.
Note
Actual values of options in the Radio Button Group widget must correspond to sheet names on a one-to-one basis, or an error message will pop up.
3) Select the widget and add a Status Change event.
Input the following JavaScript codes:
var c = this.options.form.getWidgetByName("rs");var s = c.getValue();contentPane.loadSheetByName(s);
2.2 Preview
Save the template, preview the effect in the (Data Entry Preview/Data Analysis) mode, and click any value of the Radio Button Group widget to switch to the corresponding sheet. See the demonstration below: