Web reporting tools Finereport JS API Development (II)

Source: Internet
Author: User

The first class development--fr introduced in the JS API of Finereport, this time introduces the development of FS and Contentwindow classes.

1 FS

FS is the JS interface in the data decision system, such as FS.tabPane.addItem, which first introduces several types of operations:

1.1 FS. Trans.signout ()

Exit the decision platform system

1.2 Fs.tabpane._doclosetab (Fs.tabpane._getselectedtab ())

Close the label of the current decision platform

1.3 FS.tabPane.addItem ({title: "Baidu", src: "http://www.baidu.com"})

Open a new tab in the decision platform

1.4 Example

The first two interfaces are simple, here is no longer an example, the following is a detailed description of the third interface, that is, in the data decision system to open a new tab.

1.4.1 Description

Data drillthrough is implemented using hyperlinks, open in three ways, Current window, dialog box, new window. The first 2 ways to understand well, the third open in a new window, that is, the browser to open a new tab page, if it is used in the data decision system, want to implement in the decision system framework of a new tab, instead of the browser to reopen a window, how can this be implemented?

1.4.2 Templates

The following is an example of%FR_HOME%\DEMO\BASIC\DETAILEDDRILLA.CPT, which implements the drillthrough feature in the current window, which opens in the current window and opens in a new tab page.

1.4.3 Super Link

Open the template and go to the Hyperlink Settings screen of the A4 cell, such as:


650) this.width=650; "Src=" http://dl2.iteye.com/upload/attachment/0116/0173/ C6b80031-a8c6-3918-bb97-1caf400b5527.png "style=" border:0px; "/>

The drillthrough of the order details is modified to open a new tab page in the data decision and the title of the New tab page is the order details.

Add a JavaScript hyperlink that adds a parameter ID, which is the value of the current cell, which is id=$$$, such as:


650) this.width=650; "Src=" http://dl2.iteye.com/upload/attachment/0116/0175/ 4107c095-f999-32bd-8084-e8829fcff109.png "style=" border:0px; "/>

Pass

Window.parent.FS.tabPane.addItem ({title: "Baidu", src: "http://www.baidu.com"})


The implementation opens the page in a new tab.

Title: Order Details

SRC: path to order detail template

Specific example:


650) this.width=650; "Src=" http://dl2.iteye.com/upload/attachment/0116/0177/ 3dc259d9-1ed7-3521-9223-1c209bd841be.png "style=" border:0px; "/>

Note here that the final & symbol of SRC is passed as a parameter, passing the value of the current cell to the parameter ID, and then stitching the string behind the SRC path, passing the value of the ID parameter to the order number parameter in the new template that needs to be opened.

The code is as follows:

Window.parent.FS.tabPane.addItem ({title: "Order Details", src: "${servleturl}?reportlet=demo/basic/detaileddrillb.cpt& Order number = "+id}"

1.4.4 Effect View


650) this.width=650; "Src=" http://dl2.iteye.com/upload/attachment/0116/0179/ 6dc478d0-bdc7-3008-81dd-324a88a6a171.gif "title=" Click to view the original size picture "width=" "height=" 291 "style=" border:0px; "/>

2 Contentwindow

2.1 Introduction:

Contentwindow is when the Web page is integrated, the Finereport report is embedded in the IFRAME, the interface used when invoking the report object, such as: document.getElementById (' Reportframe '). Contentwindow, where document.getElementById (' Reportframe ') is the Get IFrame object, Contentwindow is the report object, which is equivalent to the Window object in HTML.

In the Normal template JS script can directly use the properties under Contentwindow, such as direct use of Contentwindow in the ContentPane, rather than write Contentwindow, this is because the JS script itself is executed in the FR template.

A Web page uses an IFRAME to embed a report, if the document contains a frame (frame or iframe label), and the FR report is embedded in the frame, a Contentwindow object is created to obtain the IFRAME before calling Contentwindow. Then use the properties below Contentwindow

var Contentwindow = document.getElementById ("Reportframe"). Contentwindow.xxx;

Whether it is the Web page integration inside or directly in the FR template, Contentwindow The following most commonly used properties are ContentPane, so the following will be described in detail contentpane.

ContentPane is the most commonly used property under Contentwidow, which is the container for storing the contents of the report.

2.2 References ContentPane

The object can be obtained by using ContentPane directly in the JS script of the Normal template.

If the report is embedded in the IFRAME of the Web page, first get Contentwindow in the IFRAME, and then get the property ContentPane object, as follows:

var contentpane = document.getElementById (' Reportframe '). Contentwindow.contentpane;

For example, you need to get a button for the report fill page in the Web page and perform a click event:

document.getElementById (' Reportframe '). ContentWindow.contentPane.getWidgetByName (' Control name '). FireEvent (' click ')

Finereport's fill preview and form preview There will be a CURLGP object under ContentPane, which is the current logicpane.

2.3 References CURLGP

You can use CONTENTPANE.CURLGP to get the object in the JS script of the CPT template.

If the report is embedded in the IFRAME of the Web page, get the CURLGP object outside the IFRAME as follows:

var contentpane = document.getElementById (' Reportframe '). ContentWindow.contentPane.curLGP;

2.4 Write

When the preview is filled out, there is a write object under CURLGP.

2.4.1 Reference Write

You can use ContentPane.curLGP.write to get the object in the JS script of the CPT template.

If the report is embedded in an IFRAME in the Web page, get the Write object outside the IFRAME as follows:

var contentpane = document.getElementById (' Reportframe '). ContentWindow.contentPane.curLGP.write;

2.5 form

Form Preview or parameter interface, there is a Form object.

2.5.1 referencing a form

In the CPT template's JS script, you can use This.options.form to get the object, such as the Get Parameter interface drop-down box p1 the control:

var widget=this.options.form.getwidgetbyname (p1)

If the report is embedded in the IFRAME of the Web page, get the form object outside the IFRAME as follows:

var contentpane = document.getElementById (' Reportframe '). ContentWindow.contentPane.curLGP.form;


Web reporting tools Finereport JS API Development (II)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.