JS Click Button to Get Page Number

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

    How to get the page number of the content currently displayed in the report block of a dashboard?

    II. Example

    2.1 New dashboard

    1) Create a new dataset [ds1], SQL statement:

    SELECT * FROM Sales_Volume

    2) Drag and drop a report block to the dashboard, the design of report block is shown in the figure below:

    1606448917689526.png


    2.2 Let the report block to display data in pages

    1) Right-click cell A1, add Conditional Formatting, select Paginate After Row, and use the formula condition: ROW()%10=0, as shown in the following figure:

    1606449356868660.png

    2) Select the report block, click on the report toolbar in the attribute setting panel on the right, check Use toolbar, and click OK, as shown in the following figure:

    1606449356380546.png


    2.3 Add button

    Drag a button into the dashboard, the button name is get page number, and add a Click event, as shown in the following figure:

    1606449404525316.png

    The JS code in the event is:

    var a = $('div[widgetname=REPORT0]').find('.fr-texteditor').val(); //Get the current page number of report block, where report0 is the name of the report block
    var b = _g().getWidgetByName("report0").totalPage; //Get the total number of pages of the report block, where report0 is the name of the report block
    alert("NOW:" + a);
    alert("TOTAL:" + b);

    III. Preview

    3.1 PC side

    1606449404686036.gif


    3.2 Mobile

    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