Successfully!

Error!

Widget Object

  • Last update:  2020-12-14
  • I. Overview

    In order to control whether the widget is visible, set widget events, etc., it is usually necessary to obtain the widget object. In the parameter pane of cpt and frm, the data entry page of cpt and the body of frm, you can get widget objects.

    II. Get widget object

    For the parameter pane of cpt and frm, the methods are the same:

    var Widget = this.options.form.getWidgetByName("WidgetName");

    For the data entry of cpt, contentPane must be obtained first:

    var Widget = contentPane.getWidgetByName("WidgetName");

    III. Common methods of widget

    Method name
    MethodDescription

    Get Value

    Widget.getValue()

    Get widget value

    Get Value

    Widget.getText()

    Get display value

    Assign Value

    Widget.setValue()

    Assign values to parameter widget, it is not recommended to assign values to the data entry widget

    Reset

    Widget.reset() 

    Clear data

    visible

    Widget.visible()

    Set the widget to be visible

    Invisible

    Widget.invisible()

    Set the widget to be not visible

    Visible or not

    Widget.isvisible()

    Visible returns true, invisible returns false

    Set visible

    Widget.setVisible(boolean)

    Set the widget to be visible, true is visible, false is invisible

    Set enabled

    Widget.setEnable(boolean)

    Set the widget to be available, true is available, false is not available

    Enabled or not

    Widget.isEnabled()

    Return true if available, false if not available

    Call widget event

    Widget.fireEvent("Event Name")

    Set the widget to trigger an event with the specified name

    Note:

    • If the js is in the current widget, you can directly use this instead of obtaining current widget, such as this.getValue().

    • The reason why it is not recommended to use Widget.setValue() to assign a value to the data entry cell, is that the value is assigned to the widget and will be cleared before the widget passes to the cell. So it is recommended to use setCellValue() to assign a value to the data entry cell.


    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback