Button

A simple button that can have an icon. Button can be twoState and can have a badge with a number, which can be useful for displaying the number of new messages, etc.

Button control

Related sample:  Form. All DhxForm Inputs

Adding Button

You can easily add a Button control during initialization of a form:

var form = new dhx.Form("form_container", {
    rows: [
        {
            type: "button",
            name: "button",
            text: "Send",
            size: "medium",
            view: "flat",
            color: "primary"
        }   
    ]
});

Attributes

You can provide the following attributes in the configuration object of a button:

Working with Button

You can manipulate a Button control by using methods (or events) of the object returned by the getItem() method.

For example, you can disable a control on a page:

form.getItem("button").disable();

List of the control methods:

disable disables a Button control on a page
enable enables a disabled Button control
getProperties returns an object with the available configuration attributes of the control
hide hides a Button control
isDisabled checks whether a Button control is disabled
isVisible checks whether a Button control is visible on the page
setProperties allows changing available configuration attributes of the control dynamically
show shows a Button control on the page

List of the control events:

afterChangeProperties fires after configuration attributes of the control have been changed dynamically
afterHide fires after a control is hidden
afterShow fires after a control is shown
beforeChangeProperties fires before configuration attributes of the control are changed dynamically
beforeHide fires before a control is hidden
beforeShow fires before a control is shown
click fires after a click on a button control
Back to top