JS Get Data in a Specified Cell of Report Block

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

    Add a JavaScript-type hyperlink to a cell in the report block of the dashboard, the cell can display a cell value whose coordinates correspond to that specified by JavaScript.

    II. Example

    2.1 Data preparation

    Create a new dataset ds1, and the SQL statement is:

    SELECT * FROM SALES_BASIC

    1606445119309413.png


    2.2 Design report block

    Drag a report block to the dashboard body and the design of the report block is shown in the figure below:

    1606445119707495.png

    The data column in cell B2 is set to be shown in the form of Summary, as shown in the figure below:

    1606445179445895.png

    Enter the formula in cell C2: ROUND(B2 / B3 * 100, 2) + "%", which calculates the sales proportion of each salesperson.

    1606445179649143.png


    2.3 Add a hyperlink

    Select cell B2 and add a JavaScript-type hyperlink. Add a parameter named row and the parameter value is formula: row()

    1606445242201250.png

    The JS code is as follows:

    var ele = "td[id^=C" + row + "]"; //Get the coordinates of the cell, the row number is obtained through the parameter row, C is the column number
    var obj = _g().options.form.getWidgetByName("report0").
    element.click().find(ele).text(); //Get the value of the cell
    FR.Msg.alert('Proportion',obj);

    Note: report0 is the name of the report block object in the dashboard, and the object is obtained through the find method in the click event of JavaScript.


    2.4 Hidden cells

    Select column C and right click to Hide:

    1606445272420063.png

    Show only the first two columns of data

    1606445272606053.png

    III. Effect

    1606445273131138.gif

    Note: Mobile terminal is not supported.

    IV. Completed 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