Web Report Tool Finereport JS API Development (II)

Source: Internet
Author: User

Last introduced Finereport JS API in the first category of development--fr, this time to introduce the FS and Contentwindow class development.

1 FS

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

1.1 FS. Trans.signout ()

Exit decision Platform System

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

Close the label for 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, no longer illustrated here, and the third interface, which opens a new tab in the data decision system, is described in detail below.

1.4.1 Description

Data drillthrough is implemented using hyperlinks, which are open in three different ways, the current window, the dialog box, and the new window. The first 2 ways are well understood, the third is opened in a new window, that is, open a new tab page on the browser side, if it is used in the data decision system, want to implement a new tab in the framework of the decision system, instead of reopening a window on the browser side, how to achieve this.

1.4.2 Templates

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

1.4.3 Super Link

Open the template and go to the Hyperlink Settings screen in cell A4, as shown below:


Modify the order details to open a new tab page in the data decision, with the title of the New tab page as the order detail.

Add a hyperlink to a JavaScript, adding a parameter ID, the value of the parameter is the value of the current cell, id=$$$, as shown below:

Pass

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

Implementation opens the page in the New tab.

Title: Order Details

SRC: path to the Order detail template

The following figure:

Note here that the final & symbol of SRC is the pass of the parameter, the value of the current cell is passed to the parameter ID, then the string is spliced after the path of SRC, and the value of the ID parameter is passed 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


2 Contentwindow

2.1 Introduction:

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

In the common template of the JS script can be used directly under the Contentwindow properties, such as direct use of the contentpane in Contentwindow, rather than write Contentwindow, this is because the JS script itself in the FR template execution.

The Web page uses an IFRAME embedded report, if the document contains a frame (frame or iframe tag), and the FR report is embedded in the frame, a Contentwindow object is created to get the IFRAME first and then call Contentwindow. Then use the properties below Contentwindow:

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

Whether it is in the Web page integration or directly within the FR template, the most commonly used properties below Contentwindow are ContentPane, so the ContentPane is described in detail below.

ContentPane is the most commonly used attribute below Contentwidow, a container for storing the contents of a report.

2.2 Reference ContentPane

You can get the object directly using ContentPane 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 in the page to fill out a report page and perform a click event:

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

2.2.1 ContentPane Common Properties

Parameterel

Returns the object parameter interface

Curlgp

Returns the CURLGP object, only after the fill preview and the form preview

CurrentPageIndex

Current page, only page preview

Reporttotalpage

Total pages, only pagination preview report only

Zoom

Scaling ratio

Common methods of 2.2.2 ContentPane

Method

Description

APPENDREPORTRC (num)

Insert the NUM line after the selection, only fill in the report

DELETEREPORTRC ()

Delete the specified line, only fill in the report to use

DeleteRows (param)

Bulk delete param records, param as a string array of cell coordinates

Emailreport ()

Send mail

Exportreporttoexcel (' Specify format ')

Parameters are exported as page-time pages; simple-as-is export; sheet pagination sheet Export

Exportreporttoimage ()

Output picture

Exportreporttopdf ()

Output PDF

Exportreporttoword ()

Output word

FireEvent ()

Triggering events

Appletprint ()

Applet printing

Flashprint ()

Flash printing

Getwidgetbyname ()

Get the control that fills the page

Getcellvalue (cell)/getcellvalue (Col,row)

Gets the cell value, only the

Gotofirstpage ()

Jump to the first page, only the page Breaks Preview report has

Gotolastpage ()

Jumps to the last page, only the page Breaks Preview report has

Gotopreviouspage ()

Jumps to the previous page, only the page Breaks Preview report has

Gotonextpage ()

Jump to the next page, only the page Breaks Preview report has

GotoPage (num)

Jumps to the specified Num page, only the paging preview report has

Importexceldata ()

Import Excel online, only to fill in the report

On ()

Listening

Pdfprint ()

PDF print

PrintPreview ()

Print preview, only when data analysis

PageSetup ()

Page settings, only data analysis is available

Scale (STR)

Zoom, STR is magnified when "+", narrowing when "-"

Setcellvalue (Cell,null,value)/setcellvalue (Col,row,value)

Assign a value to a cell, only fill in the report

Verifyreport ()

Data validation, only fill in the report can be used

Writereport ()

Verify and submit the report, only to fill in the report

Finereport Preview and Form preview under ContentPane will have a CURLGP object, that is, current logicpane.

2.3 Reference CURLGP

The CONTENTPANE.CURLGP can be used 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.3.1 CURLGP Common Properties:

Property

Description

Currenttdcell

Fill in the preview, the cell where the current focus is

Dirtycell

Fill in the preview, edited cell

Write

Fill in the preview and return to the Write object

Form

Form Preview or parameter interface, return form object

Common methods of 2.3.2 CURLGP

Method

Description

Getcellvalue (cell)/getcellvalue (col, Row)

Gets the value of the specified grid, only the

Setcellvalue (cell, NULL, value)/setcellvalue (col, row, value)

Set the value of the specified grid, only to fill in the following

2.4 Write

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

2.4.1 Reference Write

The contentPane.curLGP.write can be used 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 Write object outside of the IFRAME as follows:

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

2.4.2 Write Common methods

Method

Description

Getwidgetbycell (cell)

Gets the control in the specified cell

Getwidgetbyname (name)

Gets the control with the specified name

Getwidgetsbyname (name)

Gets the extended control for the specified name, returning an array

2.5 form

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

2.5.1 Reference Form

In the CPT Template JS script can use This.options.form to get the object, such as get the parameter interface Drop-down box P1 this 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 of the IFRAME as follows:

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

2.5.2 form Common Properties and methods:

Property or method

Description

Name_widgets

All control collections in a form

Getvaluebyname (name)

Gets the value of the specified name control

Getwidgetbyname (name)

Gets the control with the specified name







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.