Hiding a Specified Sheet by JS

  • Last update:July 02, 2025
  • Overview

    Problem

    During initialization, some sheets among multiple sheets in a data entry report do not need to be displayed or just need to be hidden directly during initialization.

    For example, some sheets used for calculation do not need to be displayed. In this case, you can use the following method.

    Implementation Method

    You can hide the corresponding sheets by adding a Loading Start event. For details about the API description, see API Only for Data Entry Preview.

    Example

    Template Design

    The sample template contains five sheets, displaying the corresponding data of five products, respectively.

    1. Design the table style and rename each sheet, as shown in the following figure.

    1.png

    2. Set a filter condition for each sheet to display the product data corresponding to the current sheet name, as shown in the following figure.

    2.png

    Loading Start Event Adding

    Choose Template > Web Attribute > Data Entry Setting on the menu bar, select Set for This Template Separately, and add a Loading Start event, as shown in the following figure.

    3.png

    The JavaScript code is as follows.

    if (!window.flag) {
           $('li[title="Apple Juice"]').hide();
           //Hide the Apple Juice sheet.
           _g().loadSheetByName("Milk");
           //Switch to the Milk sheet.
           flag = true;
           //Use the global variable to prevent the event from being executed repeatedly.
    }

    Effect Preview

    Save the template and click Data Entry Preview. In this case, the Apple Juice sheet (the first sheet) is hidden.

    4.png

    iconNote:
    The effect cannot be previewed on mobile terminals.

    Template Download

    For details, you can download the template Hiding a Specific Sheet 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