Clicking Radio Button Groups to Switch Sheets by JS

  • Last update:May 27, 2025
  • Overview

    Problem

    When multiple sheets exist, you need to move the mouse and click tabs in the lower left corner to switch sheets. Besides, if excessive sheet tabs exist, it is hard for you to select the corresponding tab correctly. In this case, is there a simpler method to enable you to correctly select the corresponding sheet? The names of sheet tabs correspond to the values in the radio button group widget. You can switch to a specific sheet by clicking the corresponding value in the widget, as shown in the following figure.

    动图1.gif

    Implementation Method

    You can add a State Change event to Radio Button Group Widget. In this case, you can be redirected to the corresponding sheet pages when selecting different values.

    Example

    Template Preparation

    1. Create a template, add six sheets, and rename the sheets Apple, Strawberry, Orange, Pear, Blueberry, and Grape, as shown in the following figure.

    1.png

    iconNote:
    You can right-click sheet names to rename the sheets.

    2. Choose Template > Template Parameter on the menu bar and add the template parameter Fruit, as shown in the following figure.

    2.png

    3. Add the Fruit parameter to the parameter page, bind the parameter to Radio Button Group Widget, as shown in the following figure.

    3.png

    Click the icon in Data Dictionary, set Type to Custom, and customize the options as the sheet tab names, as shown in the following figure.

    iconNote:
    The actual values of options in Radio Button Group Widget must be consistent with the sheet names.

    4.png

    Event Adding

    Select Radio Button Group Widget and add a State Change event, as shown in the following figure.

    5.png

    The JavaScript code is as follows:

    var c = _g().getParameterContainer().getWidgetByName("Fruit");
    var s = c.getValue();
    _g().loadSheetByName(s);

    Effect Preview

    Save the template. Click Data Entry Preview or Data Analysis Preview to preview the report. Select a value in the radio button group widget, and you will be redirected to the corresponding sheet page. The following figure shows the effect.

    iconNote:
    The effect cannot be previewed on mobile terminals.

    Template Download

    For details, you can download the template Clicking Radio Button Groups to Switch Sheets by JS.cpt.

    Attachment List


    Theme: Data Entry
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy