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, 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))}}});
    

    ๐Ÿ†• 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. 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.
    • ๐Ÿ‘ #1449: Add allowClear option to support deselecting the value for single selects
    • #1893: Add open and close 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

    • #1709: use DOMContentLoaded event listener to auto-init bootstrap-select
    • ๐Ÿ‘ #2259: Drop IE8 support