new Bitstring(optionsopt)
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options.labels |
function |
<optional> |
"i => i + 1"
|
A function receiving
the index as argument to format the buttons labels if the buttons
are set as |
options.icons |
function |
<optional> |
"i => null"
|
A function receiving
the index as argument to format the buttons labels if the buttons
are set as |
options.length |
Number | Boolean |
<optional> |
false
|
The length of the bitstring.
Use this option to auto-generate the buttons. If you want to have more
control over the buttons displayed, set them as |
Bitstring is a specialized (Buttons) widget to display and control arrays of bits.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object |
<optional> |
{ }
|
An object containing initial options. |
Extends
Members
buttons :ChildWidgets
- Source:
- Inherited From:
An instance of ChildWidgets holding all Buttons.
Type:
- ChildWidgets
element :HTMLDivElement
- Source:
- Inherited From:
The main DIV container.
Has class .aux-buttons
.
Type:
- HTMLDivElement
Methods
addButton(options, positionopt) → {Button}
- Source:
- Inherited From:
Adds a Button to Buttons.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Button | Object | String | An alread instantiated Button, an object containing options for a new Button to add or a string for the label of the newly created Button. |
|
position |
integer |
<optional> |
The position to add the Button
to. If |
Returns:
The Button instance.
- Type
- Button
addButtons(list)
- Source:
- Inherited From:
Adds an array of buttons to the end of the list.
Parameters:
Name | Type | Description |
---|---|---|
list |
Array.<(string|object)> | An Array containing Button instances, objects with options for the buttons (see Button for more information) or strings for the buttons labels. |
empty()
- Source:
- Inherited From:
Removes all buttons.
getButtons() → {Array.<Button>}
- Source:
- Inherited From:
Returns:
The list of Buttons.
- Type
- Array.<Button>
isSelected(button) → {Boolean}
- Source:
- Inherited From:
Checks if an index or Button is selected.
Parameters:
Name | Type | Description |
---|---|---|
button |
Integer | Button | button index or Button instance. |
Returns:
- Type
- Boolean
removeButton(button, destroy)
- Source:
- Inherited From:
Removes a Button from Buttons.
Parameters:
Name | Type | Description |
---|---|---|
button |
integer | Button | button index or the Button instance to be removed. |
destroy |
Boolean | destroy the Button after removal. |
Events
added
- Source:
- Inherited From:
A Button was added to Buttons.
Parameters:
Name | Type | Description |
---|---|---|
button |
Button | The Button which was added to Buttons. |
removed
- Source:
- Inherited From:
A Button was removed from the Buttons.
Parameters:
Name | Type | Description |
---|---|---|
button |
Button | The Button instance which was removed. |
useraction
- Source:
- Overrides:
The useraction
event is emitted when a widget gets modified by user interaction.
The event is emitted for the option select
.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the option which was changed due to the users action |
value |
mixed | The new value of the option |