Refreshing Data upon Sheet Switching by JS

  • Last update:December 10, 2025
  • 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.

    预期效果.gif

    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.

    2.1 报表设计(2.png

    (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.

    2.1 报表设计(3.png

    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.2 准备 sheet1(1.png

    (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.

    2.2 准备 sheet1(2.png

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

    2.2 准备 sheet1(3.png

    sheet2 Preparation

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

    2.3 准备 sheet2(1.png

    (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.

    2.3 准备 sheet2(2.png

    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.

    2.4 添加JS代码.png

    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."

    iconNote:
    The effect cannot be previewed on mobile terminals.

    Template Download

    Download the template by clicking Refreshing Data upon Sheet Switching 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