JS Hide sheet page

  • Last update:  2020-12-15
  • I. Overview

    1.1 Problem

    In view of the fact that there are many sheet pages to be reported, some sheet pages do not need to be displayed, or they are directly hidden.


    1.2 Solution

    This is achieved by adding a loading end event in the data entry web attribute.

    II. Example

    There are two ways to hide the sheet page, one is by coordinates, and the other is by name.

    Note: The sheet page name can contain variables.

     

    2.1 Hide sheet page by coordinates

    The sheets contained in the template are as follows, including three named sheets and one empty sheet:

    1.png

    Click Template> Template Web Attributes>Data Entry Settings in the menu bar , select "individually set for this template", and add a "Loading End Event":

    Note: You need to change the variable "index" to a number, starting from 0, which represents the first sheet page .

    2.png

    $(".html-content").eq(index).hide();//Hide content
    $(".fr-tabpane-tabswrap > li").eq(index).hide();//Hide buttons
    $(".fr-tabpane-tabswrap > li").eq(index+1).click();//Click to the next sheet

    Save the template and preview it, you can see that sheet1 is hidden:

    3.png


    2.2 Hide sheet page by name

    Click Template> Template Web Attributes>Data Entry Settings in the menu bar , select "individually set for this template", and add a "Loading End Event":

    Note: You need to change the variable"SHEET NAME" to the name of the sheet to be hidden.

    4.png

    var sheet_name="SHEET NAME"; 
    var $sheet=$("li[title="+sheet_name+"]");
    if($sheet.find("span").hasClass("fr-sheetbutton-endpart")){ 
    $sheet.prev().find("span[class='fr-sheetbutton-thirdpart']").attr("class","fr-sheetbutton-endpart");
    };
    $sheet.remove();

    Save the template and preview it, you can see that the sheet named sheet2 is hidden:

    5.png


    2.3 Dynamically hide empty sheets

    Click Template> Template Web Attributes>Data Entry Settings in the menu bar , select "individually set for this template", and add a "Loading End Event":

    6.png

    $('.fr-sheetbutton-middlepart').each(function(index,e){
    if(e.innerHTML==''){
    $('[title=""]').hide()
    }
    })

    After saving the template and clicking the Data Entry preview , you can see that the empty sheet pages are hidden:

    7.png

    III. Download template

    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