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 need a multiple select , and i hope don't close dropdown option after click option.
The above method can satisfy my needs.
But, when I select options from top to bottom,after each click, dropdown will scroll to the location of the first option selected. I didn't find a better solution, I hope that after each click dropdown can stay in the click position.
The text was updated successfully, but these errors were encountered:
select2 version: 4.0.3
jquery version: 3.1.1
my code:
<select class="form-control" id="contact" name="contact"></select>
$("#contact").select2({
language: "zh-CN",
multiple: true,
dropdownParent: sendMsgSelectContactForm,
closeOnSelect: false,
placeholder: "Please select contact",
templateSelection: function (data, container) {
if (typeof (container) !== "undefined") {
$(data.element).attr('mobile', data.mobile);
$(data.element).attr('email', data.email);
}
return data.text;
},
ajax: {
url: sendMsgSelectContactForm.attr('getContactPath'),
dataType: "JSON",
type: "POST",
delay: 200,
cache: true,
data: function (params) {
params.page = params.page || 1;
let data = {};
return data;
},
processResults: function (data, params) {
params.page = params.page || 1;
var results = [];
$.each(result, function (index, obj) {
results.push({
id: obj.id.toString(),
text: obj.name
});
});
return {
results: results,
pagination: {
more: (params.page * 30) < parseInt(data.result.recordsTotal)
}
};
}
}
});
I need a multiple select , and i hope don't close dropdown option after click option.
The above method can satisfy my needs.
But, when I select options from top to bottom,after each click, dropdown will scroll to the location of the first option selected. I didn't find a better solution, I hope that after each click dropdown can stay in the click position.
The text was updated successfully, but these errors were encountered: