PickList Class
Item Index
Methods
- _clearOptions
- _createALinkButton
- _createCssButton
- _createHtmlButton
- _createYButtonNode
- _getSelectedOptions
- _loadOptions
- _loadSelections
- _onButtonAll
- _onButtonAllBack
- _onButtonBack
- _onButtonOne
- _optStdFormat
- _renderInput
- _returnOptionPerOrder
- _selOptionExists
- bindUI
- clearOptions
- clearSelections
- getSelections
Properties
Methods
_clearOptions
()
protected
Method to clear the right-hand side "selections" OPTIONS completely.
Returns:
_createALinkButton
-
subname,
-
content,
Creates an HTML link object that will be inserted into the template. The "subname" is a sub-class name to be appended to the class to identify it. Uses the internal "TMPL_alink" property as a template for the HTML.
Parameters:
-
subname,
StringThe sub-class name to be appended to the "class" for this item
-
content,
StringThe contents of the text node (i.e. "Click Me")
Returns:
_createCssButton
-
subname,
-
lcontent,
-
rcontent,
Creates an HTML object that can be used with the "cssbutton" module of 3.5.0. Uses the internal "TMPL_cssbtn" property as a template for the HTML.
The cssButton design uses a to specify the location of the IMG, on either the right or left side of the button contents (i.e. "Click Me").
So this method defines either lcontent or rcontent to specify which side of the "content" the IMG is defined on.
Parameters:
-
subname,
StringThe sub-class name to be added to the button class
-
lcontent,
StringThe sub-class name to add to the left-hand side IMG span class
-
rcontent,
StringThe sub-class name to add to the right-hand side IMG span class
Returns:
_createHtmlButton
-
subname,
-
content,
Creates an HTML object that will be inserted into the template. The "subname" is a sub-class name to be appended to the class to identify it. Uses the internal "TMPL_button" property as a template for the HTML.
Parameters:
-
subname,
StringThe sub-class name to be appended to the "class" for this button
-
content,
StringThe contents of the button face (i.e. "Click Me")
Returns:
_createYButtonNode
-
bnode,
Creates a Y.Button object by using the input "bnode" as the srcNode of the Button.
Parameters:
-
bnode,
String | | NodeThe Node of the HTML to use to create Y.Button
Returns:
_getSelectedOptions
-
sel_node,
Returns all of the HTML OPTIONS, as an array of objects containing an index, optionObject format. This is really intended to return the right-hand side "selections" Options element, irregardless of whether an Option is "selected" / highlighted or not.
Parameters:
-
sel_node,
StringThe SELECT object to get all options of (whether "selected" flag is set or not)
Returns:
_loadOptions
()
Number
protected
Method to load the left-hand side "options" HTML element with the user-defined options array.
Returns:
_loadSelections
()
Number
protected
Method to load the right-hand side "selections" HTML element with the user-defined selections array.
Returns:
_onButtonAll
-
e,
The "Add All" button click handler. Adds all of the "Available" options to the "selected" Options, checking to avoid duplicates. This method checks if the Widget is a "stack", if so, it moves the Option from left to right.
Parameters:
-
e,
EventHandleThe button's Eventhandle from the button .on "click" event
Returns:
_onButtonAllBack
-
e,
The "Remove All" button click handler. Removes all of the option(s) from the "Selections" right-side options. This method checks if the Widget is a "stack", if so, it moves the Option from right to left, otherwise it destroys it.
Parameters:
-
e,
EventHandleThe button's Eventhandle from the button .on "click" event
Returns:
_onButtonBack
-
e,
The "Remove One" button click handler. Removes the DOM selected option(s) from the "Selections" right-side options. This method checks if the Widget is a "stack", if so, it moves the Option from right to left, otherwise it destroys it.
Parameters:
-
e,
EventHandleThe button's Eventhandle from the button .on "click" event
Returns:
_onButtonOne
-
e,
The "Add One" button click handler. Adds the DOM selected option(s) from the "Available" options to the right-hand side HTML , checking to avoid duplicates. This method checks if the Widget is a "stack", if so, it moves the Option from left to right.
Parameters:
-
e,
EventHandleThe button's Eventhandle from the button .on "click" event
Returns:
_optStdFormat
()
Object
protected
Internal method to normalize the 'text', 'value', and 'title' data based upon the input "optionsMap" of the "options" attribute. Returns an object that can be used directly by the JS new Option( text, value ) command.
Returns:
_renderInput
()
protected
Method to create the DOM elements for this Widget, including two HTML elements, and four BUTTONS to operate on the Widget.
The method uses the "template" attribute if set for positioning of the above UI elements, if none is provided a default template is used.
Returns:
_returnOptionPerOrder
()
protected
Internal method intended to return the provided opt_node object back to the "options" SELECT OPTION in the original defined order. This would only be used for "stackMode" and "preserveOrder" true.
Returns:
_selOptionExists
-
opt_node,
Utility function to avoid duplicate adding an option to the right-hand side "selections" Options element. This method checks if the "opt_node" already exists in the "selections" Options, if so it returns TRUE, if not it returns FALSE.
Parameters:
-
opt_node,
NodeThe Option node to check for existence.
Returns:
bindUI
()
public
Method that binds the button pushes to their handlers. Keep a reference to the handler in this._eventHandles so we can detach them later.
clearOptions
()
public
Method to clear the left-hand side "options" SELECT OPTIONS completely.
Returns:
clearSelections
()
public
Method to clear the right-hand side "selections" SELECT OPTIONS completely.
Returns:
getSelections
()
Array
public
Returns the current items in the "right side" SELECT OPTIONS box.
Returns:
Properties
_eventHandles
Array
private
Holder for the "action" click event handlers
_optionNode
Object
private
Holder for the Y.Node of the SELECT left-hand side "available" options.
_optOrder
Array
private
Holder for the original OPTIONS order, to be used with "preserveOrder" (NOT IMPLEMENTED)
_selectNode
Object
private
Holder for the Y.Node of the SELECT right-hand side "selected" or chosen options
CLASS_ACTION
Object
private
TMPL_alink
String
protected
The template to use for constructing the HTML elements within the widget (for buttonType='link')
TMPL_control
String
protected
The default "template" to use for rendering of this widget.
TMPL_cssbtn
String
protected
The template to use for constructing the HTML elements within the widget (for buttonType='cssbutton')
TMPL_inputs
String
protected
The template to use for constructing the HTML elements for left/right side
Attributes
actionLabelAll
String
The label to be used for the BUTTON face for "Add All" action.
Default: 'Add All'
actionLabelRmv
String
The label to be used for the BUTTON face for "Remove" action.
Default: 'Remove'
actionLabelRmvAll
String
The label to be used for the BUTTON face for "Remove All" action.
Default: 'Remove All'
optClassName
String
Classname to be applied to the "options" element, usually used to specify the "width" of the element.
Default: ''
options
Array
The Array to populate the SELECT / OPTIONS on the left-side, herein referred to as "options" in this widget.
Elements of this array aren't required to have members { text:'', value:''}, if the members are different they can be mapped to the expected settings using the "optionsMap" attribute.
If the members of this array are non-object single-items, they are assumed to be the "text" item, and the "value" will also be set to this item.
Default: []
optionsMap
Object
An object having members "value, text, title" that defines the mapping between the provided "options" array data and the expected parameters of the JavaScript new Option('text', 'value').
Default: { value:'value', text:'text', title:'title' }
preserveOrder
Boolean
NOT IMPLEMENTED AT THIS TIME
A flag setting for preserving the original order of the options, when add or
remove actions are taken. With "preserveOrder" false, all items are added to the
bottom of the left / right side HTML SELECT / OPTIONS. If set to TRUE, the
options are returned to proper order from the original "options" setting.
This only has relevance when "stackMode" is TRUE.
Default: false
selClassName
String
Classname to be applied to the "selected" element, usually used to specify the "width" of the element.
Default: ''
selected
Array
The Array to populate the SELECT / OPTIONS on the right-side, herein referred to as "selected" in this widget. For example, if a FORM is opened with default multi-selected items, they would be provided in this attribute as an array.
Elements of this array aren't required to have members { text:'', value:''}, if the members are different they can be mapped to the expected settings using the "optionsMap" attribute.
If the members of this array are non-object single-items, they are assumed to be the "text" item, and the "value" will also be set to this item.
Default: []
selectSize
String
The default "width" style of the left and right side SELECT / OPTIONS control.
Default: '9em'
selectSize
Int
The number of options to display in the left and right side SELECT / OPTIONS control.
Default: 10
stackMode
Boolean
A flag setting for enabling "stack" mode of this widget. In "stack" mode the JS Options are moved from left-to-right individually, so that they can't be re-used inadvertantly.
For example, "Add One" from the left option MOVES the option to the right-side "selections". If "Remove One" is chosen, the right-side selected item is returned to the bottom of the left-hand side options. (Can't currently return it to the index of where it came from ... see "preserveOrder").
Default: false
template
String
The DOM ID element of the "template" to be used for defining the OPTIONS, SELECTIONS, and the BUTTONS.
Expected replacable placeholder tokens positioned within the "template" are identified as;
{OPTIONS_CONTAINER} : Left-hand side "Options" <select> placeholder
{SELECTIONS_CONTAINER} : Right-hand side "Selected" <select> placeholder
{ACTION_ALL} : Placeholder for the "Add All" button
{ACTION_ONE} : Placeholder for the "Add One" button
{ACTION_BACK} : Placeholder for the "Remove One" button
{ACTION_ALLBACK} : Placeholder for the "Remove All" button
Default: ''