Successfully!

Error!

JS Click Button to Get Page Number

  • Last update:  2020-12-16
  • 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: Dashboard
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback