Successfully!

Error!

You are viewing 10.0 help doc. More details are displayed in the latest help doc

JS Redirect to another page (on click or regularly)

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: Secondary Development
Already the First
Already the Last
  • Helpful
  • Not helpful
  • Only read

Doc Feedback