:rocket: The jQuery plugin that brings select elements into the 21st century with intuitive multiselection, searching, and much more.
TypeError
exceptions when up/down arrow pressedCannot read property 'position' of undefined
errorCannot read property 'index' of undefined
errormore
argument as an additional argument to the source.data
/source.search
callback functionsFull Changelog: https://github.com/snapappointments/bootstrap-select/compare/v1.14.0-beta2...v1.14.0-beta3
To install: npm install bootstrap-select@next
.
The highlight of this release is support for using Ajax/JSON as the data source. This includes a new source
option, which supports 3 properties: data
, load
, and search
. All 3 support a function that passes an array of options to the callback argument. Alternatively, an array can be set (probably more useful for data
). If source.load
is set, it will be called when reaching the bottom of the dropdown menu. If source.search
is set, bootstrap-select's internal search functionality will be bypassed, allowing you to perform the search yourself. If performing a search and source.search
is set, it will be called again when reaching the bottom of the dropdown menu.
Example usage:
$('#test2').selectpicker({
source: {
data: function (callback) {
var array = [
{
text: 'Tent',
icon: 'fa-camera'
},
{
text: 'Flashlight',
selected: true
},
{
text: 'Disabled Option',
disabled: true
},
{
value: 'divider',
divider: true
},
{
text: 'Toilet Paper'
}
];
callback(array);
},
load: function (callback, page) {
$.ajax('/api/load-more', { data: { page } })
.then((response) => callback(response.data))
},
search: function (callback, page, searchTerm) {
$.ajax('/api/search', { data: { page, search: searchTerm } })
.then((response) => callback(response.data))
}
}
});
form.reset()
is calledtitle
to set the select's placeholder has been deprecated. Use placeholder
instead. title
will no longer set the placeholder starting in v2.0.0. title
and placeholder
can still be used together to support a placeholder and a custom title.allowClear
option to support deselecting the value for single selectsopen
and close
methodsliveSearchStyle
for custom filtering