Toolbar API

  • Last update:August 29, 2024
  • Version

    Version
    Functional Change

    11.0

    Difference from 10.0:

    • Changed the button aquisition API parameter. In the 11.0 version, the button name is used.

    • Added toolBarFloat and setStyle APIs.

    • Added the getToolbar API.

    iconNote:

    1. To using all toolbar APIs in a general report, only one toolbar (either the top or bottom toolbar) can exist in the report.

    2. The following APIs cannot be used in the FVS visualization dashboard.


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

    getWidgetByName

    Method

    getWidgetByName(name)

    This API is used to get the button on the report toolbar and can be used with the button methods.

    Parameter

    name: string

    Button name, which is a string. The following lists common button names.

    • submit: submission button

    • verify: data validation

    • first: homepage

    • previous: previous page

    • next: next page

    • last: last page

    • newprint: printing

    • flashprint: printing (client)

    • email: email

    • export: export

    iconNote:
    The export button is supported only in 11.0.27 and later versions.
    • PDF: PDF

    • pagenavi: current page/total number of pages

    • stashbutton: temporary storage

    • clear: clearance

    Returned Value

    Button object

    object

    Example

    Example 1: If the obtained toolbar object is defined as toolbar, get the email button on the toolbar using the following command.

    toolbar.getWidgetByName("email");

    Example 2: Get the email button on the   toolbar in a general report using the following command.

    _g().getToolbar().getWidgetByName("email");


    Application   Example

    After successful submission, the Email and Print buttons are hidden on the toolbar.

    Click to download the template: Invisible Toolbar Button.cpt.

    工具栏接口 图1.gif

    Mobile Terminal

    This API is not supported on mobile terminals.

    getToolbar

    iconNote:
    To using this API in a general report, only one toolbar (either the top or bottom toolbar) can exist in the report.


    Usage in General Reports

    getToolbar()

    This API is used to get the toolbar object.

    Parameter

    /

    /

    Returned Value

    Button object

    object

    Example

    Example 1: If the obtained report object is defined as report, get the toolbar object using the following command.

    report.getToolbar();

    Example 2: Get the toolbar object in a general report using the following command.

    _g().getToolbar();
    Application Example

    /

    Mobile Terminal

    This API is supported on mobile terminals.

    The following table describes how to us this API in dashboards.

    Usage in Dashboards

    getToolbar(index)

    This API is used to get the report block toolbar and can be used when the toolbar is open. After getting the toolbar, you can use the toolbar API and toolbar button API.

    Parameter

    index: number

    Toolbar position, which is a number.

    • 0: top toolbar

    • 1: bottom toolbar

    Returned Value

    Toolbar object

    object

    Example

    Example 1: If the obtained report block object is defined as report, get the toolbar object using the following command.

    report.getToolbar(0);

    Example 2: Get the top toolbar object of the report0 block in a dashboard using the following command.

    _g().getWidgetByName("report0").getToolbar(0);

    Example 3: Get and hide the top toolbar of the report0 block in a dashboard using the following command.

    _g().getWidgetByName("report0").getToolbar(0).setVisible(false);


    Application Example

    Click the button to hide the report block toolbar in a dashboard.

    Click to download the template: Hiding the Report Block Toolbar.frm

    工具栏接口 图2.gif

    Mobile Terminal

    This API is supported on mobile terminals.

    toolBarFloat

    Method

    toolBarFloat(direction)

    This API is used to set the toolbar display position.

    Parameter

    direction: string

    Display method, which is a string.

    • left: left alignment

    • right: right alignment

    • center: center alignment

    Returned Value

    void

    Example

    Example 1: If the obtained toolbar object is defined as toolbar, center the toolbar using the following command.

    toolbar.toolBarFloat('center');

    Example 2: Center the toolbar in a general report using the following command.

    _g().getToolbar().toolBarFloat('center');

    Example 3: Center the toolbar in a dashboard using the following command.

    _g().getWidgetByName('report0').getToolbar(0).toolBarFloat('center');
    Application Example

    Center the toolbar in a general report.

    Click to download the template: Centered Toolbar.cpt.

    工具栏接口 图3.png

    Mobile Terminal

    This API is not supported on mobile terminals.

    setStyle

    Method

    setStyle(style)

    This API is used to resize the toolbar.

    Parameter

    style:

    {

    width: number,

    height: number

    }

    Toolbar size, which is in JSON format.

    • width: toolbar length

    • height: toolbar height

    Returned Value

    void

    Example

    Example 1: If the obtained toolbar object is defined as toolbar, resize the toolbar to 900 in lenght and 60 in height using the following command.

    toolbar.setStyle({    width: 900,    height: 60});

    Example 2: Resize the toolbar to 900 in lenght and 60 in height in a general report using the following command.

    _g().getToolbar().setStyle({    width: 900,    height: 60});

    Example 3: Resize the toolbar to 900 in lenght and 60 in height in a dashboard using the following command.

    _g().getWidgetByName('report0').getToolbar(0).setStyle({    width: 900,    height: 60});


    Application Example

    Resize the toolbar to 900 in lenght and 60 in height in a general report.

    Click to download the template: Toolbar Resizing.cpt.

    工具栏接口 图4.png

    Mobile Terminal

    This API is not supported on mobile terminals.

    setVisible

    Method

    setVisible(visibility)

    This API is used to show/hide the toolbar.

    Parameter

    visibility: boolean

    Whether to show the toolbar (boolean type).

    • true: toolbar display

    • false: toolbar hidden

    Returned Value

    void

    Example

    Example 1: If the obtained toolbar object is defined as toolbar, hide   the toolbar using the following command.

    toolbar.setVisible(false);

    Example 2: Hide the toolbar in a general report using the following command.

    _g().getToolbar().setVisible(false);

    Example 3: Hide the toolbar in a dashboard using the following command.

    _g().getWidgetByName('report0').getToolbar(0).setVisible(false);


    Application Example

    Hide the toolbar in a general report.

    Click to download the template: Toolbar Hiding.cpt.

    工具栏接口 图5.png

    Mobile Terminal

    This API is supported on mobile terminals.

     


    Attachment List


    Theme: Secondary Development
    • 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