JS API Overview

  • Last update:  2021-01-29
  • 1.Overview

    FineReport opens a large number of JS APIs to users. Users can use these JS APIs to implement more functionalities. This article lists commonly used objects and their descriptions. For details of their methods, please refer to the corresponding articles.

    2.Objects

    2.1 FR

    link: https://help.fanruan.com/finereport-en10.0/doc-view-3739.html 

    1)Description

    Through this object, you can refer to properties and methods embedded in FineReport. In the designer, FR.XXX can be called directly. In external webpages, you must include finereport.js in order to use FR.XXX.

    2)Example

    pop-up warning: FR.Msg.alert(title, message,callback)


    2.2 FS

    link: https://help.fanruan.com/finereport-en10.0/doc-view-606.html 

    1)Description

    Through this object, you can refer to properties and methods that can operate on the decision system. It is included in finereport.js as well.

    2)Example

    open new tab on the decision platform : FS.tabPane.addItem(entry)


    2.3 contentWindow

    1)Description

    During the Web integration, embed the FineReport into IFrame and use contentWindow when calling report object externally.

    2)Example

    get Window object in IFrame : document.getElementById('reportFrame').contentWindow


    2.4 contentPane

    link: https://help.fanruan.com/finereport-en10.0/doc-view-619.html 

    1)Description

    Container that places CPT report content, which is an entire CPT report object, where CPT has it but FRM does not.

    2)Example

    get CPT cell in data entry mode widget:contentPane.getWidgetByCell("A1")


    2.5 _g()

    1)Description

    In CPT , _g() is the whole report object, is equivalent to contentPane, supports all the methods that contentPane can offer; In FRM, _g() is the whole report object globalForm,supports all the methods that globalForm offers

    2)Example

    query in in CPT / FRM parameter pane widget : _g().parameterCommit() 


    2.6 paramterEL(Link)

    1)Description

    Parameter Pane. In CPT, it is obtained from contentPane.parameterEL;In FRM, it is obtained from _g().parameterEL.

    2)Example

    get the value of parameter pane widget after loading in CPT

    FR.Msg.alert("alert", contentPane.parameterEl.getWidgetByName("aa").getValue())


    2.7 curLGP

    link: https://help.fanruan.com/finereport-en10.0/doc-view-610.html 

    1)Description

    it is equivalent to current logic pane. Under the preview of data entry mode and decision report, contentPUane has a curLGP object to be used to get the cell。

    2)Example

    get the current focused cell under data entry mode preview : contentPane.curLGP.currentTDCell


    2.8 form

    1)Description

    Form object. The parameter pane in CPT and FRM are forms, the main body of FRM is form.

    2)Example

    get the value of other widgets during the button click in the CPT bparameter pane

    FR.Msg.alert("alert", this.options.form.getWidgetByName("aa").getValue())


    2.9 Widgets(Link )

    1)Description

    ways to get widgets are:

    1、Get the current widget by 'this' in widget event

    2、getWidgetByName() / getWidgetByCell(),detailed usage instruction is in the link

    2)Example

    Get the widget value after the edit of text widget in the CPT parameter pane:

    FR.Msg.alert("alert", this.getValue())


    2.10 Chart

    link: https://help.fanruan.com/finereport-en10.0/doc-cate-22.html 

    1)Description

    the premise of getting charts is getting dashboard charts, which includes cells, floating element, dashboard charts in the decision report and charts in report block. After getting the charts, refreshing and carouseling can be taken in effect.

    2)Example

    get the first chart in dashboard charts in cell A1:

    FR.Chart.WebUtils.getChart(“A1”).getChartWithIndex(0)



    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • 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