Controlling Tab Pages to be Hidden or Displayed by Database Table Field

  • Last update:October 17, 2025
  • Overview

    Expected Effect

    iconNote:
    You need to prepare a database table before using this template.

    Control whether the tab pages of the tab component in FVS are displayed through the field values set in the database table.

    The database table has two fields: TYPE (Spring, Summer, Autumn, and Winter) and SITUATION (Show and Hide), as shown in the following figure.

    预期效果1.png

    The tab component has a total of four tab pages: Spring, Summer, Autumn, and Winter. In the front end, only Spring and Summer are displayed according to the content of the SITUATION field in the database table, as shown in the following figure.

    预期效果2.gif

    Implementation Method

    Add the permission values to control whether the tab pages of the tab component are displayed in the database table, and add an initialization event for the table component to implement the final effect.

    Example

    Preparing a Database Table

    First, create a table SEASON in the local database with two fields: TYPE and SITUATION. The following figure shows the table style.

    预期效果1.png

    Creating a Template

    (1) Choose File > New FineVis Visualization Dashboard from the menu bar in the upper left corner of the designer to create a blank FVS dashboard, as shown in the following figure.

    新建模版1.png

    (2) Customize the name of the dashboard, canvas size, and template style as required, and click Create Dashboard, as shown in the following figure.

    新建模版2.png

    Adding and Designing a Tab Component

    (1) Choose Other > Tab in the upper left corner of the template canvas to add the tab component to the canvas, as shown in the following figure.

    添加设计tab组件1.png

    (2) Click New Tab Page in the upper right corner of the component to add three more tab pages, as shown in the following figure.

    设计添加tab组件2.gif

    (3) Drag a table component into each tab page and adjust the component size. Take the first tab page as an example, as shown in the following figure.

    设计添加tab组件3.gif

    (4) Select the tab component in Tab List on the right, click Component, and set Name to Season, as shown in the following figure.

    设计添加tab组件4new.png

    (5) Set Name to Spring, Summer, Autumn, and Winter for the four tab pages, respectively, and Title Content to Spring, Summer, Autumn, and Winter for them, respectively. Take the first tab page as an example, as shown in the following figure.

    设计添加tab组件5new.png

    (6) Set the names of the four table components to Vernal, Aestival, Autumnal, and Hibernal, respectively, to distinguish them from the names of the previous tab pages. Take the first table as an example, as shown in the following figure.

    设计添加tab组件6new.png

    (7) Select the table component, click Content, and click Edit Component to enter the component editing page. Take the Vernal table as an example, as shown in the following figure.

    设计添加tab组件7new.png

    (8) After entering the table component editing page, you can input custom text content. Take the Vernal table as an example, as shown in the following figure.

    设计添加tab组件8.png

    (9) Click Return to FineVis Visualization Dashboard in the upper left corner of the component editing page to return to the dashboard page.

    (10) Select the tab component in Tab List on the right, click Content, and set Layout Mode to Equal, as shown in the following figure.

    设计添加tab组件10new.png

    Adding an After Initialization Event

    Select any table component and add an after initialization event.

    (1) Take the Vernal table as an example. Select the table Vernal in Tab List on the right, choose Interaction > Interaction Event > Add Event > After Initialization > JavaScript, and input JavaScript code, as shown in the following figure.

    初始化事件-1.png

    The JavaScript code is as follows:

    setTimeout(function(){
    for(var i = 0; i < a.length; i++) { 
        for(var j=0;j<= a[i].length;j++){ 
    duchamp.getWidgetByName('Season').getPage(a[j]).setVisible(false);
        }
    }
      }, 50)

    (2) Click Parameter Setting to add a parameter a. Set Parameter Type to Custom Formula, and set Parameter Content to the formula split(SQL("FRDemo","SELECT TYPE FROM SEASON WHERE SITUATION='Hide'",1),","). The following table explains the formula in detail.

    Formula

    Description

    SQL("FRDemo","SELECT TYPE FROM SEASON WHERE SITUATION='Hide'",1)

    Return the data in the TYPE column where the value in the SITUATION column is Hide.

    split(SQL("FRDemo","SELECT TYPE FROM SEASON WHERE SITUATION='Hide'",1),",")

    Split the return result of the SQL function by commas to generate an array: [Autumn, Winter].

    初始化事件-2.png

    Effect Display

    PC

    After the template is completed, click Preview in the upper right corner. The preview effect is the same as that shown in the section "Expected Effect."

    Mobile Terminal

    For details about the preview method, see FVS Template Preview and Mounting. The following figure shows the effect.

    移动端.gif

    Template Download

    Attachment List


    Theme: FineVis Data Visualization
    • 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