$(document).ready(function () {
$.widget("ui.dialog", $.ui.dialog, {
//解决Dialog控件使用select2不出现光标的问题
open: function () {
return this._super();
},
_allowInteraction: function (event) {
return !!$(event.target).is(".select2-search__field") || this._super(event);
}}
);
var user_select2_option = {
ajax: {
url: "/util/account",
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term
};
},
processResults: function (data, page) {
return {
results: data.items
};
},
cache: true
},
allowClear: true,
minimumInputLength: 2
};
$(".user-select2").select2(user_select2_option);
delete user_select2_option['allowClear'];
});