Simple select list replacement for jQuery
npm install pfkl-vselect``
import "pfkl-select/vselect/vselect.min.js";
$('#my-select').vSelect({
settings...
});
`
@import "~pfkl-vselect/vselect/vselect";
`$3
`
`$3
#### multiSelect
Allowed only one or multiple selection.
`
multiSelect: true|false
`Default is true
#### placeholder
Custom placeholder text.
`
placeholder: 'Please select'
`#### checkAll
Add a check all option to the list. Only applicable if multiSelect is true.
`
checkAll: true|false
`Default is true
#### checkAllLabel
Label text for check all option.
`
checkAllLabel: 'All'
`#### expanded
Option group is expanded or collapsed by default.
`
expanded: true|false
`Default is true
#### display
Selected options display style.
`
display: 'sum'|'values'
`
display: 'sum', eg. output:
2 option(s) selecteddisplay: 'values', eg. output:
Apple; Banana; Orange
Default is 'sum'
#### trayHeight
Set custom tray height.
`
trayHeight: '###px'|'auto'
`Default is '240px'
#### dropdown
true: tray display as overlay dropdown, false: tray display as inline block
`
dropdown: true|false
`Default is true
#### search
true: let user seach option via an search input box, false: no search input box.
`
search: true|false
`Default is false
#### searchPosition
-1: match string with any position of the label text, 0: match only from beginning of label text, Any integer number above 0: only match position from given number.
`
searchPosition: -1|0|#
`Default is -1
#### onChange
On change call back function.
values: Current changed option, options: entire options collection.
`
onChange: function(values, options) {}
`$3
#### resetOptionsUncheck/unselect all options.
`
$('class/id').data('vSelect').resetOptions();
`Changelog
$3
Remove unwanted packages.$3
Added resetOptions method.$3
Added new settings option - searchPosition.$3
Added search feature.$3
Close tray when clicked outside of vSelect container.$3
Bug fix - hide original select element.$3
Fix a bug where initialise by class name is broken.$3
Enabled preselected options.$3
Remove console log.$3
Bug fix.$3