JS Click Button to Jump to Specific Component

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

    1.1 Problem description

    When there are many components in the dashboard, the canvas will be large, making it difficult to quickly select the frequently-used components. It is hoped that you can jump to the designated components by clicking a button.

    1.2 Solutions

    By adding a JS click event to the button widget, when the button is clicked, you can jump to the specified component.

    II. Example

    2.1 Report design

    1) Add three charts and a button widget to the dashboard, and the charts are bound to the data, as shown in the following figure:

    1606376569576123.png

    2) Add Click event to button widget, as shown below:

    1606376569872131.png

    The JS code is as follows:

    var a=document.getElementsByClassName('fr-titlelayout ui-state-enabled')[2];
    a.setAttribute('id','Chart1');
    //If the id produced by the chart block is different every time it is refreshed,
    //then you need to get the chart object first, 
    //and then set a fixed id for it before jumping
    document.getElementById('Chart1').scrollIntoView();
    //CHART1 is the id of the corresponding component


    2.2 Effect preview

    Save the report and preview. The effect is as shown in the figure below:

    1606376570212096.gif

     

    Note: Mobile terminal is not supported.

    III. Completed Template

    Attachment List


    Theme: Secondary Development
    • 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