Global API

  • Last update:April 14, 2025
  • Version

    Version
    Functional Change

    11.0

    Difference from 10.0:

    • Added the getPreviewType and getParameterContainer APIs.

    • Deprecated contentPane (available in 10.0), with the related APIs migrated to _g(). (The APIs on contentPane.curLGP are not yet compatible.)

    11.0.7

    Supported the duchamp API in FVS visualization dashboards for FineReport with the FineVis Data Visualization plugin of V1.8.0 and later versions.

    Global APIs allow you to manipulate the entire report. The APIs and attributes of other elements in the report are inherited from the global APIs.

    To access and operate other elements in the report, you must first use a global API to obtain the report object.

    Before API use, read JS API Compatibility Description carefully. APIs are supported in both general reports and dashboards (new version) by default.

    _g()


    API

    _g()

    To obtain the report object, which allows you to use this API in conjunction with the APIs and attributes of the report object. If multiple sheets exist in Data Entry Preview, the obtained object is the table object in the currently selected sheet.

    Parameter

    -

    -

    Returned Value

    object

    Report object

    Example

    Example 1: You can obtain the parameter panel object after obtaining the report object.

    _g().getParameterContainer();

    Example 2: You can obtain the report block object named report0 after obtaining the report object.

    _g().getWidgetByName('report0');

    Example 3: You can submit the parameter value to requery the report using the parameterCommit API after obtaining the report object.

    _g().parameterCommit();

    Application Example

    You can query the report after selecting the value from the drop-down list without clicking the query button, as shown in the following figure.

    For details, you can download the template Automatic Query Without Clicking the Query Button by JS.cpt.

    Mobile Terminal

    This API is supported on mobile terminals.

    _g().getParameterContainer();


    API

    _g().getParameterContainer();

    To obtain the parameter panel object, which allows you to use this API in conjunction with the APIs for the parameter panel.

    Parameter

    -

    -

    Returned Value

    object

    Parameter panel object

    Example

    Example 1: You can obtain the parameter panel after obtaining the report object.

    _g().getParameterContainer();

    Example 2: You can obtain the drop-down box widget named comboBox0 on the parameter panel after obtaining the parameter panel object.

    _g().getParameterContainer().getWidgetByName("comboBox0");

    Application Example

    You can assign values to widgets on the parameter panel, as shown in the following figure.

    For details, you can download the template Value Assignment to a Widget on the Parameter Panel.cpt.

    Mobile Terminal

    This API is supported on mobile terminals.

    parameterCommit

    iconNote:
    When using this API in FineReport of a version earlier than V11.0.6, you need to add the timeout function setTimeOut().

    API

    parameterCommit();

    To submit the parameter value and requery the report, triggering a report refresh.

    Parameter

    -

    -

    Returned Value

    void


    Example

    You can submit the parameter value and requery the report after obtaining the report object.

    _g().parameterCommit();

    Application Example

    You can query the report after selecting the value from the drop-down list without clicking the query button, as shown in the following figure.

    For details, you can download the template Automatic Query Without Clicking the Query Button by JS.cpt.

    Screen Recording 2025-04-11 at 16.57.14 (1).gif

    Mobile Terminal

    This API is supported on mobile terminals.

    loadContentPane


    API

    loadContentPane()

    To reload and refresh the page without submitting the parameter value.

    Parameter

    -

    -

    Returned Value

    void


    Example

    You can refresh the page after obtaining the report object.

    _g().loadContentPane();

    Application Example

    You can click the button to refresh the report, as shown in the following figure.

    For details, you can download the template Report Refresh by Clicking the Button.cpt.

    Mobile Terminal

    This API is supported on mobile terminals.

    getPreviewType


    API

    getPreviewType()

    To obtain the current preview mode of a report.

    Parameter

    -

    -

    Returned Value

    string

    String, which represents the current preview mode.

    • preview: pagination preview for CPT reports/non-mobile preview for FRM reports

    • view: data analysis preview

    • write: data entry preview

    • mobile-preview: mobile preview

    • mobile-write: mobile data entry preview

    Example

    The API can return the current preview mode of the obtained report object.

    _g().getPreviewType();

    Application Example

    You can design a pop-up box to appear when Data Analysis Preview is not supported in certain reports.

    For details, you can download the template Report Preview Mode.cpt.

    image.png

    Mobile Terminal

    This API is supported on mobile terminals.

    duchamp


    API

    duchamp

    • To obtain the component object in the FVS visualization dashboard, which allows you to use this API in conjunction with the APIs and attributes of the component object.

    • To call global APIs, which allows you to use this API in conjunction with the APIs and attributes of the FVS component object

    Parameter

    -

    -

    Returned Value

    object

    FVS Component object

    Example

    Example 1: You can obtain the table component and enable the marquee effect.

    duchamp.getWidgetByName("Table name").startMarquee();

    Example 2: You can obtain the component object and hide the component with one click.

    duchamp.getWidgetByName("Component name").setVisible(false);

    Application Example

    -

    Mobile Terminal

    This API is not supported on mobile terminals.


    Attachment List


    Theme: Secondary Development
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    9s后關閉

    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