2023-04-16 03:31:40 +02:00
|
|
|
(function () {
|
2023-04-23 15:55:31 +02:00
|
|
|
const element = document.getElementById('newMember').elements['user_id'];
|
2023-05-02 02:22:57 +02:00
|
|
|
const select = new TomSelect(element, {
|
|
|
|
valueField: 'value',
|
|
|
|
labelField: 'label',
|
|
|
|
searchField: 'label',
|
|
|
|
loadThrottle: 300,
|
|
|
|
load: function (query, callback) {
|
|
|
|
var self = this;
|
|
|
|
RVR.httpRequest('GET', searchUserUrl.replace('QUERY', encodeURIComponent(query)), function () {
|
|
|
|
self.clearOptions();
|
|
|
|
callback(this.response.results);
|
|
|
|
});
|
|
|
|
},
|
2023-04-16 03:31:40 +02:00
|
|
|
});
|
|
|
|
|
2023-05-02 02:22:57 +02:00
|
|
|
select.on('change', function (value) {
|
|
|
|
this.clearOptions();
|
|
|
|
});
|
|
|
|
|
|
|
|
select.on('blur', function (value) {
|
|
|
|
this.clearOptions();
|
|
|
|
});
|
2023-04-16 03:31:40 +02:00
|
|
|
|
2023-05-02 02:22:57 +02:00
|
|
|
select.on('type', function (value) {
|
|
|
|
if (value === '') {
|
|
|
|
this.clearOptions();
|
|
|
|
}
|
2023-04-16 03:31:40 +02:00
|
|
|
});
|
|
|
|
})();
|