JS Redirect to another page (on click or regularly)

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

    1.1 Problem

    In the production of making reports, we often use the redirection of reports to carry parameters from one report to another, on click or regularly. At this time, we need to use JS for assistance.


    1.2 Solution

    Use the following JS:

    window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Sales Analysis.frm");

    II. Example 1: redirect regularly

    2.1 Master report

    1) Open report %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Dashboard\Cost Gateway.frm

    2) In the widget settings on the right, select body and add an event after initialization

    image.png

    JavaScript:

    setTimeout(function() {
    window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Sales Analysis.frm");
    }, 2000);


    3.2 Sub report

    1) Open report %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Dashboard\Sales Analysis.frm

    2) In the widget settings on the right, select body and add an event after initialization

    image (1).png

    JavaScript:

    setTimeout(function() {
    window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Cost Gateway.frm");
    }, 2000);


    3.3 Preview effect

    The template jumps from one report to another every 2 seconds, realizing automatic rotation, and the effect is shown in the following figure:

    iShot2020-10-31 21.12.24.gif

    III. Example 2: redirection on click

    Bind a redirection event to a widget.


    3.1 Report modification

    Also take the above two dashboards as an example. Delete the after initialization events of the body of the two reports.

    For Cost Gateway.frm, select the chart0 widget, and add click events, as shown below:

    image (2).png

    JavaScript:

    window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Sales Analysis.frm");


    3.2 Preview effect

    The report will be redirected after clicking on one block.

    iShot2020-10-31 21.23.59.gif

    IV. Download template

    5.1 Example 1: redirect regularly

    1) Master report:

    Cost Gateway.frm

    2) Sub report

    Sales Analysis.frm


    5.2 Example 2: redirection on click

    Cost Gateway_goto.frm


    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