CheckboxView

The Checkbox view

Description

The Checkbox view displays a checkbox and returns a Boolean value indicating whether it is checked.

Library path

Properties

Name

Default value

Description

id Required. The unique ID for this control.
defaultThe default value.
disabledfalseIndicates whether to disable the view.
initialValueThe initial value of the input. If defaultis specified, it overrides this value.
settingsThe properties of the view. See the methods below to get and set values.
valueThe Boolean value of the checkbox.

Methods

Name

Description

renderDraws the control to the screen. Called only when you create the view manually.
settings.get( property )Returns the value of property for the current component.
settings.set( propertyvalue )Sets the value of property to the specified value for the current component.
valReturns the view's value if passed no parameters. Sets the view's value if passed a single parameter.

Events

Name

Description

changeFired when the value of the view changes.

Example

require([
    "splunkjs/mvc/checkboxview",
    "splunkjs/mvc/simplexml/ready!"
], function(CheckboxView) {

    // Instantiate components
    new CheckboxView({
        id: "example-checkbox",
        default: false,
        el: $("#mycheckboxview")
    }).render();

});