Skip to main content

getWidget()

returns the DHTMLX ColorPicker widget attached to a ColorPicker control

getWidget(): Colorpicker;

Returns:

An object of the DHTMLX ColorPicker widget.

Example

const colorpicker = form.getItem("colorpicker").getWidget();  
// -> DHTMLX ColorPicker

Related sample: Form. Get widget of control

It is possible to use methods of DHTMLX ColorPicker via the getWidget() method of a ColorPicker control.

For example, you can set focus on the specified value in the control. To do this, you need to get the widget attached to the ColorPicker control and then use the setFocus() method of this widget.

const colorpicker = form.getItem("colorpicker").getWidget();  // -> ColorPicker
colorpicker.setFocus("#BDF0E9"); // sets focus on the "#BDF0E9" color