Skip to content
Steve James edited this page Mar 12, 2018 · 32 revisions

Interact with the multiselect instance after it has been initialized by calling any of the below methods (listed in alphabetical order).

// example:
$("#foobar").multiselect("method_name", "parameter_1", "parameter_2", "...");

addOption

Allows you to add an option to the widget menu and the source element without the need for a refresh.

Parameters:

attributes: Attributes object for the option element being added. Should at least contain a value.

text: Text to display for the option

groupID: If supplied, the option will be added under the option group with this index or textual label.


buttonMessage

Displays a message in the widget button for one second.

Parameter:

message The message to display.


checkAll

Check all checkboxes.

Parameter:

groupID (optional) If provided, only the options that are in the option group corresponding to groupID (group index or group label) are checked.

Note: If the maxSelected option is set, this method will be ignored by the widget code.


close

Closes the menu. If a close effect was specified as a widget option, then it will be used.


collapseAll

Collapse all option groups.

Parameter:

groupID (optional) If supplied, only the options that are in the option group corresponding to groupID (group index or group label) are collapsed.


destroy

Destroy the widget and return to the original select box.


disable

Disable the entire widget.

Parameter:

groupID (optional) If supplied, only the options that are in the option group corresponding to groupID (group index or group label) are disabled.


enable

Enable the entire widget.

Parameter:

groupID (optional) If supplied, only the options that are in the option group corresponding to groupID (group index or group label) are enabled.


expandAll

Expand all option groups.

Parameter:

groupID (optional) If supplied, only the options that are in the option group corresponding to groupID (group index or group label) are expanded.


flipAll

Invert (flip) all checkboxes.

Parameter:

groupID (optional) If supplied, only the options that are in the option group corresponding to groupID (group index or group label) are flipped.

Note: If the maxSelected option is set, this method may be ignored by the widget code, depending on how many checkboxes would be checked after the method runs.


getButton

Returns the button element.


getChecked

Returns an array of all the checked boxes.


getCollapsed

Returns an array of the collapsed option groups.


getLabels

Returns the labels for the options within the widget, the inputs are children of these labels.


getMenu

Returns the menu element for the widget.


getNamespaceID

Returns the namespace ID of the current widget instance.


getUnchecked

Returns an array of all the boxes that are not checked.


isOpen

Returns a boolean denoting if the widget is currently open or not.


open

Opens the menu. If an open effect was specified as a widget option, then it will be used.


option

Set or get one of the options (settings, not menu or select options) after the widget has been initialized. If changing an option, the new option setting will take affect immediately.


position

Resets the positioning of the menu relative to the button. This may be needed if the div containing the button is scrolled, for example.


refresh

Reloads the checkbox menu. If you're dynamically adding/removing option tags on the original select via AJAX or DOM manipulation methods, call refresh to reflect the changes in the widget.

Parameter:

init (optional) If true, the refresh event is not triggered. Default = false


removeOption

Removes an option from the menu and source element that has the given value.

Parameters:

value The value attribute of the element to be removed.


resync

Resynchonizes the widget's checkboxes with the selected states of the underlying native select options. This is useful if you set the value of the native select, then need to reflect the change in the widget.

Parameter:

skipDisabled (optional) If true, disabled options are not changed. Default = false


uncheckAll

Uncheck all checkboxes. In single select mode, this will also clear the current selection.

Parameter:

groupID (optional) If supplied, only the options that are in the option group corresponding to groupID (group index or group label) are unchecked.


update

Updates the button text to reflect the number of current selections or the list of current selections, if the selectedList option is set.

Parameter:

isDefault (optional) If true, the button text is also set as the default for the button to prevent form resets from reverting the text to the prior default value. Default = false


value

Returns the value of the native select or sets it and re-synchronizes the widget.

Parameter:

newValue (optional) The new value to set.


widget

Returns the menu container (all checkboxes inside).

Clone this wiki locally