I've merged some of the pull requests from the original author's repo to make this plugin useable for me.
If you submit patches I'll try be a little more on top of maintaining them.
- sortable (true) : enable sorting the selected items.
- dragToAdd (true) : enable adding selected items by dragging.
- searchable (true) : enable searching for available items.
- doubleClickable (true) : enable adding selected item by double clicking.
- singleClickable (false) : enable adding selected item by single clicking (when true, forces
doubleClickable
to be false). - animated (fast) : animation option.
- show (slideDown) : show effect.
- hide (slideUp) : hide effect.
- dividerLocation (0.6) : the ratio of the size of the left column versus the right column.
- selectedContainerOnLeft : controls which side the selected container is on.
- width (null) : width of widget.
- height (null) : height of widget.
- nodeComparator : the function for comparing nodes.
- includeRemoveAll (true): include the Remove All feature.
- includeAddAll (true): include the Add All feature.
- pressEnterKeyToAddAll (false): enable pressing enter to add any items in the filtered list to the Selected List. Pressing enter acts the same as clicking "Add All" would.
<!--HTML-->
<select class="multiselect" multiple="multiple" id="colors" name="colors">
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
//Javascript: setup multiselect.
$("#colors").multiselect({
dividerLocation: .5
}).change(function (e) {
//output values.
console.log($('#colors').val());
});
Merged contribution from mgalgs:
*Added singleClickable option
Merged the following contributions from NateEag:
*Tweak word-wrap to handle very long single words
Merged the following contributions from ryoe:
- Support for pressing Enter key to "Add All"
Merged the following contributions from Garyzhu:
- Added options to exclude the Remove all and Add all controls.
Merged the following contributions from NateEag:
- Added 'refresh' method to change the selections in a multiselect programmatically
Merged the following contributions from NateEag:
- Set overflow to hidden for select items to fix issue where if you add a long option to a select that has little space, it'll overflow into the next one.
Merged the following contributions from NateEag:
- Rename selectedColumnOnRight to selectedColumnOnLeft
- Unfixed math fix
Merged the following contributions from NateEag:
- Removed trailing whitespace.
- Prevent multi-clicks from duplicating items.
- Add option to set which side the selected items are shown on.
- Add public method for dynamically adding options.
- Fix a one-pixel error in size calculations.
- Added "DragToAdd" option that can turn off support for dragging to add. Since you currently can't drag to remove.
- Added Example and Options documentation to this ReadMe
- Updated so change event is fired on Remove All and Add All
- Merged code from NateEag to fix duplicate items - issues 90 & 91
- Merged code from chickenchan to fix issue with loosing sort order - issue 22
- Updated so width doesn't expand past what the target elements width is. Borders were causing this to happen.
- Add code to trigger the original select boxes change event whenever the list changes.
- Added support for specifying width and height. If not specified it will default to using the target element's dimensions which can be inconsistent if the target is a select element and it's not visisble.
This repository is no longer actively maintained by the author. However, pull requests are always welcome. If there's someone interested in officially maintaining the plugin, please let me know.
In case you are looking for an AJAX version, please also consider "Yanick Rochon's":http://github.com/michael/multiselect/tree/next version.