bootstrap-select v1.14.0-beta Release Notes
Release Date: 2020-11-28 // over 3 years ago-
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
, andsearch
. All 3 support a function that passes an array of options to the callback argument. Alternatively, an array can be set (probably more useful fordata
). Ifsource.load
is set, it will be called when reaching the bottom of the dropdown menu. Ifsource.search
is set, bootstrap-select's internal search functionality will be bypassed, allowing you to perform the search yourself. If performing a search andsource.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))}}});
๐ New Features
- ๐ #899: Ajax/JSON data source support
- #1315: Reset select element when
form.reset()
is called - ๐ #1416, #2147: Using
title
to set the select's placeholder has been deprecated. Useplaceholder
instead.title
will no longer set the placeholder starting in v2.0.0.title
andplaceholder
can still be used together to support a placeholder and a custom title. - ๐ #1449: Add
allowClear
option to support deselecting the value for single selects - #1893: Add
open
andclose
methods - ๐
#2042: Support assigning a function to
liveSearchStyle
for custom filtering
๐ Bug Fixes
- #2507: Placeholder doesn't work when the first option is disabled
๐ฅ Breaking Changes