Successfully!

Error!

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

Widget General Use

getValue

MethodgetValue()

Get the actual value of the widget

  Parameter--
 Return valueany
    Example

Example 1: If the obtained widget object is defined as widget, get the actual value of the widget

widget.getValue();

Example 2: Get the actual value of the text0 widget on the parameter pane

_g().getParameterContainer().getWidgetByName("text0").getValue();

Example 3: Obtain the actual value of the text0 widget in the data entry cell in a general report

_g().getWidgetByName("ext0").getValue();

Example 4: Get the actual value of the text0 widget in the body in the dashboard

_g().getWidgetByName("text0").getValue();

Applicaiton

example

Get the value of the date widget, when the difference between the start time and the end time is greater than 30 days, a pop-up reminder:

For detailed implementation methods, please refer to: JS implements date widget query days control

1.gif

Mobile
Support mobile terminal

getText

MethodgetText()

Get the display value of the widget

  Parameter--
 Return valuestring
    Example

Example 1: If the obtained widget object is defined as widget, get the display value of the widget

widget.getText();

Example 2: Get the display value of the text0 widget on the parameter pane

_g().getParameterContainer().getWidgetByName("text0").getText();

Example 3: Obtain the display value of the text0 widget in the data entry cell in a general report

_g().getWidgetByName("text0").getText();

Example 4: Obtain the display value of the text0 widget in the body in the dashboard

_g().getWidgetByName("text0").getText();

Application

example

After selecting a value from the drop-down box, print its actual and displayed values:

Click to download the template: 

Obtain widget displayed value.cpt

2.gif

MobileSuuport mobile terminal

setValue

MethodsetValue(value)Set the value of the widget
  Parametervalue: anyWidget value, any format
Return valuevoid
    Example

Example 1: If the obtained widget object is defined as widget, set the value of the widget to "text"

widget.setValue('text');

Example 2: Get the widget text0 on the parameter pane and set its widget value to "text"

_g().getParameterContainer().getWidgetByName("text0").setValue('text');

Example 3: Get the text0 widget in the data entry cell in a general report, and set its widget value to "text"

_g().getWidgetByName("text0").setValue('text');

Example 4: Get the text0 widget in the body in the dashboard, and set its widget value to "text"

_g().getWidgetByName("text0").setValue('text');

Application

example

Click the button and set the appropriate value for the date widget:

For detailed implementation methods, please refer to: JS Custom Buttons Assign Specified Range Values

3.gif

MobileSupport mobile terminal

visible

Methodvisible()Set widget visible
  Parameter--
Return valuevoid
   Example

Example 1: If the obtained widget object is defined as widget, set it to be visible

widget.visible();

Example 2: Get the widget text0 on the parameter pane and set it to be visible

_g().getParameterContainer().getWidgetByName("text0").visible();

Example 3: Get the text0 widget in the data entry cell in a general report and set it to be visible

_g().getWidgetByName("text0").visible();

Example 4: Get the text0 widget in the body in the dashboard and set it to be visible

_g().getWidgetByName("text0").visible();

Application

example

Click the button to display some of the widgets in the parameter pane:

Click to download the template: 

Set widget visible.cpt

4.gif

MobileSupport mobile terminal

invisible

Methodinvisible()Set widget invisible
  Parameter--
Return valuevoid
   Example

Example 1: If the obtained widget object is defined as widget, set it to be invisible

widget.visible();

Example 2: Get the widget text0 on the parameter pane and set it to be invisible

_g().getParameterContainer().getWidgetByName("text0").visible();

Example 3: Get the text0 widget in the data entry cell in a general report and set it to be invisible

_g().getWidgetByName("text0").visible();

Example 4: Get the text0 widget in the body in the dashboard and set it to be invisible

_g().getWidgetByName("text0").visible();

Application

example

Click the button to hide some of the widgets in the parameter pane:

Click to download the template: 

Set widget invisible.cpt

5.gif

MobileSupport mobile terminal

setVisible

MethodsetVisible(visibility)Set widget visible/invisible
  Parametervisibility: boolean

Whether visible,boolean

  • true:visible

  • false:invisible

Return valuevoid
    Example

Example 1: If the obtained widget object is defined as widget, set it to be invisible

widget.setVisible(false);

Example 2: Get the widget text0 on the parameter pane and set it to be invisible

_g().getParameterContainer().getWidgetByName("text0").setVisible(false);

Example 3: Get the text0 widget in the data entry cell in a general report and set it to be invisible

_g().getWidgetByName("text0").setVisible(false);

Example 4: Get the text0 widget in the body in the dashboard and set it to be invisible

_g().getWidgetByName("text0").setVisible(false);

Application

example

Only after the content of the previous drop-down box is selected, the next layer of drop-down box widget is displayed:

For detailed implementation methods, please refer to: JS Control whether the Parameter Widget is Displayed

6.gif

Mobile Support mobile terminal

isVisible

MethodisVisible()Whether the widget is visible
  Parameter-

-

Return valueboolean

Whether visible, boolean

  • true:visible

  • false:invisible

    Example

Example 1: If the obtained widget object is defined as widget, return whether it is visible

widget.isVisible();

Example 2: Get the cwidget text0 on the parameter pane and return whether it is visible

_g().getParameterContainer().getWidgetByName("text0").isVisible();

Example 3: Get the text0 widget in the data entry cell in a general report, and return whether it is visible

_g().getWidgetByName("text0").isVisible();

Example 4: Get the text0 widget in the body in the dashboard and return whether it is visible

_g().getWidgetByName("text0").isVisible();

Application

example

After the province widget selects the value, the query button is visible; otherwise, the query button is invisible:

Click to download the template: 

Whether widget visible.cpt

7.gif

MobileSupport mobile terminal

setEnable

MethodsetEnable(enabled)Set widget enabled/disabled
  Parameterenabled: boolean

Whether enabled, boolean

true:enabled

false:disabled

Return valuevoid
    Example

Example 1: If the obtained widget object is defined as widget, set it to be disabled

widget.setEnable(false);

Example 2: Get the widget text0 on the parameter pane and set it to be disabled

_g().getParameterContainer().getWidgetByName("text0").setEnable(false);

Example 3: Get the text0 widget in the data entry cell in a general report and set it to be disabled

_g().getWidgetByName("text0").setEnable(false);

Example 4: Get the text0 widget in the body in the dashboard and set it to be disabled

_g().getWidgetByName("text0").setEnable(false);

Application

example

Grades can only be selected once, and once selected makes the widget disabled:

For the detailed implementation method, please refer to: JS implements the data entry widget can only fill in once

8.gif

MobileSupport mobile terminal

isEnabled

MethodisEnabled()Whether the widget is enabled
  Parameter-

-

Return valueboolean

Whether enabled, boolean

  • true:enbaled

  • false:disabled

   Example

Example 1: If the obtained widget object is defined as widget, return whether it is enabled

widget.isVisible();

Example 2: Get the cwidget text0 on the parameter pane and return whether it is enabled

_g().getParameterContainer().getWidgetByName("text0").isVisible();

Example 3: Get the text0 widget in the data entry cell in a general report, and return whether it is enabled

_g().getWidgetByName("text0").isVisible();

Example 4: Get the text0 widget in the body in the dashboard and return whether it is enabled

_g().getWidgetByName("text0").isVisible();

Application

example

After the province widget selects the value, the query button is enbaled; otherwise, the query button is not enabled:

Click to download the template: 

Whether widget enabled.cpt

9.gif

MobileSupport mobile terminal

reset

Methodreset()Reset the widget, clear the content of the widget
 Parameter-

-

Return valuevoid
   Example

Example 1: If the obtained widget object is defined as widget, clear the content of the widget:

widget.reset();

Example 2: Get the widget text0 on the parameter pane and clear the content of the widget:

_g().getParameterContainer().getWidgetByName("text0").reset();

Example 3: Get the text0 widget in the data entry cell in a general report, and clear the content of the widget:

_g().getWidgetByName("text0").reset();

Example 4: Get the text0 widget in the body in the dashboard, and clear the content of the widget:

_g().getWidgetByName("text0").reset();

Application

example

Click the button to clear all widget values:

For the detailed implementation method, please refer to: JS Reset the Widget Value

10.gif

MobileSupport mobile terminal

getType

MethodgetType()Get widget type
  Parameter-

-

Return valuestringString, returns the default widget name type, such as button for button, comboBox for drop-down box
   Example

Example 1: If the obtained widget object is defined as widget, return its type

widget.getType();

Example 2: Get the cwidget text0 on the parameter pane and return its type

_g().getParameterContainer().getWidgetByName("text0").getType();

Example 3: Get the text0 widget in the data entry cell in a general report and return its type

_g().getWidgetByName("text0").getType(); 

Example 4: Get the text0 widget in the body in the dashboard and return its type

_g().getWidgetByName("text0").getType();

Application

example

Click the button to get the widget type:

Click to download the template: 

View widget type.cpt

11.gif

MobileSupport mobile terminal

setWaterMark

MethodsetWaterMark(text)Add watermark text (only supports widgets with input boxes)
  Parametertext: string

Watermark text, string

Return valuevoid
   Example

Example 1: If the obtained widget object is defined as widget, add a watermark of "Please enter your name" to it

widget.setWaterMark('Please enter your name');

Example 2: Get the widget text0 on the parameter pane and add a watermark of "Please enter your name" to it

_g().getParameterContainer().getWidgetByName("text0").setWaterMark('Please
enter your name');

Example 3: Obtain the text0 widget in the data entry cell in a general report, and add a watermark of "Please enter your name" to it

_g().getWidgetByName("text0").setWaterMark('Please enter your name');

Example 4: Obtain the text0 widget in the body of the dashboard, and add a watermark of "Please enter your name" to it

_g().getWidgetByName("text0").setWaterMark('Please enter your name');

Note: After adding an event, after an error is reported because the report block object is not completely created, you can add a delay function to delay execution, such as:

setTimeout(function(){
    _g().getParameterContainer().getWidgetByName("text0").
    setWaterMark('Please enter your name');
}, 500);

Application

example

Add a watermark to the textbox widget:

Click to download the template: 

Widget watermark.cpt

12.png

MobileSupport mobile terminal

fireEvent

MethodfireEvent(eventName);Call widget event
  ParametereventName: string

Event type, string, value can refer to: widget event, such as "after initialization" event is afterinit

Return valuevoid
   Example

Example 1: If the obtained widget object is defined as widget, trigger the "after initialization" event of the widget

widget.fireEvent('afterinit');

Example 2: Get the widget text0 on the parameter pane and trigger its "after initialization" event

_g().getParameterContainer().getWidgetByName("text0").fireEvent('afterinit');

Example 3: Obtain the text0 widget in the data entry cell in a general report, and trigger its "after initialization" event

_g().getWidgetByName("text0").fireEvent('afterinit');

Example 4: Get the text0 widget in the body in the dashboard and trigger its "after initialization" event

_g().getWidgetByName("text0").fireEvent('afterinit');
Application exampleIn the dashboard, click the button to assign a value to the date widget, and at the same time trigger the "after editing" event of the date widget to submit a parameter query:

For detailed implementation methods, please refer to: Dashboard button queries the data of the latest date

13.gif

MobileSupport mobile terminal

setPopupStyle

Method

setPopupStyle(PopupStyle)

Set the style of the widget drop-down option box. Only widgets with option boxes are supported, such as drop-down boxes and drop-down check boxes.

  Parameter

PopupStyle:{

    itemHeight: string;
    fontSize: string;
}

PopupStyle: Popup style, json format

  • itemHeight: the height of the options in the popup

  • fontSize: The font size of the popup box

Return valuevoid
   Example

Example 1: If the obtained drop-down box widget object is defined as widget, set its pop-up box option height to 30px and font size to 20px

widget.setPopupStyle({
    itemHeight:"30px",
    fontSize:"20px"
});

Example 2: Get the drop-down box widget comboBox0 on the parameter pane, and set its pop-up box option height to 30px and font size to 20px

widget.setPopupStyle({
    itemHeight:"30px",
    fontSize:"20px"
});

Example 3: Obtain the drop-down box widget comboBox0 in the data entry cell in a general report, and set its pop-up box option height to 30px and font size to 20px

_g().getWidgetByName("comboBox0").setPopupStyle({
    itemHeight:"10px",
    fontSize:"10px"
});

Example 4: Obtain the drop-down box widget comboBox0 in the body in the dashboard, and set its pop-up box option height to 30px and font size to 20px

_g().getWidgetByName("comboBox0").setPopupStyle({
    itemHeight:"30px",
    fontSize:"20px"
});

Note: After adding an event, after an error is reported because the report block object is not completely created, you can add a delay function to delay execution, such as:

setTimeout(function(){
_g().getParameterContainer().getWidgetByName("comboBox0").setPopupStyle({
    itemHeight: "10px",
    fontSize: "10px"
});
}, 500);

Application

example

Set the drop-down box option height to 30px and font size to 20px:

Click to download the template:

Widget style.cpt

14.png

Mobile Support mobile terminal

return false

Method-

Add return false to the specific event of the widget, without triggering linkage and query

  Parameter-

-

Return value-
   Example

Add a "After Edit" event to the drop-down checkbox widget of the dashboard, the content of the event is:

return false;

Application

example

The widget added in the dashboard body will trigger the query action immediately after entering the value:

15.gif

If you want to click the button to start the query after entering the value, you can add an event to the drop-down box widget to not trigger the query:

16.gif

Click to download the template: 

Query is not triggered after selecting a value from the drop-down box.frm


Mobile Support mobile terminal














Attachment List


Theme: 11.0 New Features
Already the First
Already the Last
  • Helpful
  • Not helpful
  • Only read

Doc Feedback