Successfully!

Error!

You are viewing 10.0 help doc. More details are displayed in the latest help doc

Reference widget and methods of widget

I. Overview

Widgets have many methods, such as controlling whether the widget is visible, whether it is available, etc. The widget must be obtained before calling the widget method. Starting from version 6.5.5, in the parameter interface of cpt and frm, in the data entry interface of cpt and in the body of frm, you can get the widget and reference the widget method.

However, in versions before 6.5.5, the widget is not available in the data entry interface.

II. Get widget

The method of obtaining the widget in the parameter interface and the dashboard interface is the same. First obtain the dashboard, and then obtain the widget by the widget name, as shown below:

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

To obtain the widget when data entry, first obtain the report object contentPane, and then obtain the widget by the widget name, as shown below:

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

III. Common methods of widgets

The widget can be obtained by the above method. For example, if the widget variable we obtain is Widget, then the widget method can be called through Widget.getValue();.

The widget methods are listed below, assuming that the acquired widget variable is Widget:

Method nameMethodDescription
Get valueWidget.getValue()Get widget value
Get valueWidget.getText()Get widget display value
Set valueWidget.setValue()Set values to the parameter widgets, it is not recommended to set values to the data entry widgets
ResetWidget.reset()Clear data
Whether is visibleWidget.isVisible()Returns whether the widget is visible, returns true to be visible, false to be invisible
set visibleWidget.setVisible(boolean)Set whether the widget is visible, the parameter is true to be visible, false to be invisible
set enableWidget.setEnable(boolean)Set whether the widget is available, the parameter is true to be available, false to be unavailable
Whether is enableWidget.isEnabled()Returns whether the widget is available, returns true to be available, false to be unavailable
Call widget eventWidget.fireEvent("eventname")Set the widget to trigger an event with the specified name

Note: If the JavaScript is in the event of the current widget, you can use this directly without getting the current widget, such as this.getValue();

In addition: the value filled in Widget.fireEvent("event name") can be viewed in the Widget Event.

Another: Widget.setValue() method is to assign values to widgets, but it is not recommended to use this method to assign values to widgets on the data entry page, because this is to assign values to widgets, not cells. If you use this method to assign values when data entry, after the value is assigned to the widget for the second time, before the value is passed to the cell, it will be cleared, and the value of the last cell is still empty, so it is recommended to use setCellValue() to assign a value to the widget on the data entry page.


Attachment List


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

Doc Feedback