JS Get the Value of Cells in Report Blocks

  • Last update:December 16, 2020
  • I. Overview

    1.1 Requirement

    How to get the value of a cell in a report block of a dashboard, as shown below:


    1.2 Solution

    Add a JS event to the button widget to get the value of A1 in report0:

    1.2.1 Method 1

    var a=$("tr[tridx=0]","div#REPORT0").children().eq(0).html();

    Note

    In which, tridx=0  is the line number and eq(0)  is the column number.

    1.2.2 Method 2

    var a = _g().options.form.getWidgetByName("report0").element.find("td[id^=A1-]").text();

    II. Sample

    2.1 Create a dashboard

    Create a dashboard and add a report block which is designed as follows:


    2.2 Add a button widget

    Add two buttons respectively named [Get cell value-method 1] and [Get cell value-method 2] in the dashboard, as shown below:


    2.3 Add a click event to the button widget

    2.3.1 Method 1

    Click on the button and add a click event, as shown below:

     

    Input the following JS codes:

    var a = $("tr[tridx=0]", "div#REPORT0").children().eq(0).html();alert(a);

    2.3.2 Method 2

    Click on the button and add a click event, as shown below:

     

    Input the following JS codes:

    var a = _g().options.form.getWidgetByName("report0").element.find("td[id^=A1-]").text();
    alert(a);

     

    2.4 Preview

    Save the template and click [Preview]. By clicking the button, a dialog box named East China will pop up. See “1.1 Requirement” for the effect picture.

    III. Download the template

    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