You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was hoping someone could point me in the right direction here. I am using two different selectpickers. The first select changes values in my ajaxselect selctpicker. It is working fine but I noticed that because I am using the cache from ajax select it is possible to get incorrect data to the user.
I am attempting to destroy the selectpicker and then reinit it when the first select is changes.bs.select but my ajax select never comes back and it just stays as a standard bootstrap select.
var $selectOne = $('#selectOne');
var $selectTwo = $('#selectTwo');
var options = {
ajax: {
url: 'ajax',
type: "GET",
dataType: "json",
contentType: 'json',
data: function () {
var params = {
term: '{{{q}}}'
};
params.changedValue = parseInt($('#selectOne').val()) > 0 ? parseInt($('#selectOne').val()) : null;
return params;
}
},
locale: {
searchPlaceholder: 'Search for stuff...',
statusInitialized: 'Start typing to begin search'
},
clearOnEmpty: false,
log: 4,
minLength: 2,
requestDelay: 500,
preserveSelected: false
};
$selectOne.on('changed.bs.select', function () {
$selectTwo.selectpicker('destroy');
$selectTwo.selectpicker({ liveSearch: true }).ajaxSelectPicker(options);
});
The text was updated successfully, but these errors were encountered:
@coreynbryant yeah we don't really support that out of the box. The thing Ajax-Bootstrap-Select is looking for on initialize is the jquery data property AjaxBootstrapSelect. If you do:
instead it should let Ajax-Bootstrap-Select go through its normal init. I'm not sure to be honest if this will have other side effects but it should force the re-init.
I was hoping someone could point me in the right direction here. I am using two different selectpickers. The first select changes values in my ajaxselect selctpicker. It is working fine but I noticed that because I am using the cache from ajax select it is possible to get incorrect data to the user.
I am attempting to destroy the selectpicker and then reinit it when the first select is changes.bs.select but my ajax select never comes back and it just stays as a standard bootstrap select.
The text was updated successfully, but these errors were encountered: