CheckboxView
Description
The Checkbox view displays a checkbox and returns a Boolean value indicating whether it is checked.
Documentation
Library path
splunkjs/mvc/checkboxview
Properties
Name | Default value | Description |
id | | Required. The unique ID for this control. |
default | | The default value. |
disabled | false | Indicates whether to disable the view. |
value | | The Boolean value of the checkbox. |
Methods
Name | Description |
render | Draws the control to the screen. Called only when you create the control manually in JavaScript. |
val | Returns the view's value if passed no parameters. Sets the view's value if passed a single parameter. |
Events
Name | Description |
change | Fired when the value of the view changes. |
Example (Django tag)
{% checkbox id="example-checkbox" default=False %}
Example (JavaScript)
<script>
var deps = [
"splunkjs/ready!",
"splunkjs/mvc/checkboxview"
];
require(deps, function(mvc) {
var CheckboxView = require("splunkjs/mvc/checkboxview");
// Instantiate components
new CheckboxView({
id: "example-checkbox",
default: false,
el: $("#mycheckboxview")
}).render();
});
</script>
Code examples