Module: alfresco/forms/controls/PushButtonsControl

alfresco/forms/controls/PushButtonsControl

An input control that offers the functionality of radio-buttons or checkboxes (depending on the mode, rendered as a single control with push-button options.
Since:
  • 1.0.44
Author:
  • Martin Doyle
License:
Source:

Members

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/PushButtonsControl.css"}]
Source:

id :string

The ID of this control
Type:
  • string
Default Value:
  • null
Source:

maxChoices :number

The maximum number of choices selectable by the user. This will always be one in single-item mode. Attempts to select an item once this limit has been reached will result in the oldest selection being deselected. If the value is 0 (the default), then there will be no forced limit on the number of choices in multi-item mode.

NOTE: The accessibility of this control relies on the fact that, underneath, it's backed by either radio buttons or checkboxes. The use of this property can make checkboxes behave like radio buttons, and so its accessibility could be affected.

Type:
  • number
Since:
  • 1.0.65
Default Value:
  • 0
Source:

maxLineLength :number

Maximum number of buttons on a line (zero means no limit)
Type:
  • number
Default Value:
  • 0
Source:

minPadding :number

The minimum padding to apply to the side of the buttons. This is ignored on fixed-width controls.
Type:
  • number
Default Value:
  • 50
Source:

multiMode :boolean

Whether to run the control in multi-value mode (i.e. behave like checkboxs rather than the default radio-buttons behaviour).
Type:
  • boolean
Default Value:
  • false
Source:

name :string

The name of this control in the form
Type:
  • string
Default Value:
  • null
Source:

noWrap :boolean

Disable line-wrap on the labels if set to true.
Type:
  • boolean
Default Value:
  • false
Source:

<readonly> opts :object[]

Local store of the current control options, as an ordered collection of option objects.
Type:
  • object[]
Default Value:
  • null
Source:

percentGap :number

The gap (margin) to have between buttons, expressed as a percentage of the total width of the control.
Type:
  • number
Default Value:
  • 1
Source:

rootClass :string

The root class of this widget
Type:
  • string
Source:

selections :Object[]

A FIFO queue of selections that is active only in multi-item mode when maxChoices is not zero, and will be used to deselect oldest selections when the maxChoices is exceeeded.
Type:
  • Object[]
Since:
  • 1.0.65
Default Value:
  • null
Source:

simpleLayout :boolean

When the simple layout is selected control of the layout of buttons is surrendered to the default behaviour. This means that buttons are not of equal widths and will fill the available space as best they can. Enabling this feature disables width, [percentGap]{@link module:alfresco/forms/controls/PushButtonsControl#percentGap}, noWrap and [maxLineLength]{@link module:alfresco/forms/controls/PushButtonsControl#maxLineLength}.
Type:
  • boolean
Since:
  • 1.0.72
Default Value:
  • false
Source:

templateString :String

The HTML template to use for the widget.
Type:
  • String
Source:

width :number

The total width of the control in pixels. Zero indicates that the control should take as much space as needed.
Type:
  • number
Default Value:
  • 0
Source:

Methods

_onInputChanged(evt)

Fires when the value is changed.
Parameters:
Name Type Description
evt Object The change event
Since:
  • 1.0.65
Source:

addOption(option)

Add an option to the control.
Parameters:
Name Type Description
option object The option to be added
Source:

constructor()

Constructor
Source:

getOptions() → {object[]}

Get the current options
Source:
Returns:
The current options
Type
object[]

getValue() → {object[]}

Get the current value(s) of this control
Source:
Returns:
The currently selected options
Type
object[]

postCreate()

Widget has been created (but not necessarily sub-widgets)
Source:

removeOption(option)

Remove the selected option from the control.
Parameters:
Name Type Description
option object The option to be removed
Source:

resize()

Resize the control
Source:

setValue(value)

Set the value of the control. When not in multi-value mode, the value must should be a single value, rather than an array.

All values in the array must be valid values for the control's current options, or this function will do nothing.

Parameters:
Name Type Description
value * The value to be set
Source: