JS Control the Properties of Toolbar Buttons

  • Last update:  2020-12-16
  • I. Description

    Scenario description: After the report is reviewed and submitted, and after the data entry submitted successfully, we hope to change the attributes of some buttons in the toolbar, such as enabled/disabled, visible/invisible, to prevent other misoperations.

    As shown below, after successful submission, the printing and output functions are disabled:

     1.gif

    You will learn


    • Ideas

    • Operating steps

    • Preview

      • Preview on PC terminal

    • Completed template

    II. Ideas

    We can use JS to control on-off of buttons according to the serial number of buttons by using the event of “Data Entry Successful” in the Data Entry Settings page on “Template Web Attributes”.

    III. Operating steps

    Open the report %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\RowForm\Simple_Row-based_Form.cpt

    Select Template > Template Web attribute > Data Entry Settings, and add a “Data Entry Successful” event, as shown below:

    2.png 

    contentPane.toolbar.options.items[3].setEnable(false);
    // The subscript starts from 0 from left to right, and the fourth button (Print) is disabled
    contentPane.toolbar.options.items[4].setEnable(false);
    // The subscript starts from 0 from left to right, and the fifth button (Output) is disabled

    Note: When setting attributes, the button used to trigger events should not be set as disabled (that is, the “Submit” button cannot be set)

    Code interpretation:

    contentPane.toolbar.options.items: What is returned is an array collection of all buttons on the toolbar, which is referenced by subscripts (starting from 0).

    Method name

    Method 

    Description 

    Enabled

    Button. setEnable(true)

    Settings button is enabled

    Disabled

    Button. setEnable(false)

    Settings button is disabled

    Visible

    Button. setVisible(true)

    Set the widget as visible

    Invisible

    Button. setVisible(false)

    Set the widget as invisible

    There are other formats of JS statements for getting report toolbar buttons. See Document Get Report Toolbar Button.

    IV. Preview

    4.1 Preview on PC terminal

    Save the template and use the Data Entry Preview. The preview effect is as above.

    Note: In our testing, the mobile terminal temporarily does not support this effect.

    V. Completed template

    Attachment List


    Theme: Report Application
    • 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