2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 12:36:45 +00:00

select2 fixes

This commit is contained in:
Oliver 2021-07-02 21:36:41 +10:00
parent a47948ffe0
commit 07910766b3

View File

@ -981,13 +981,13 @@ function initializeRelatedField(name, field, options) {
var pageSize = options.pageSize || 25; var pageSize = options.pageSize || 25;
select.select2({ select.select2({
ajax: {
url: field.api_url,
dataType: 'json',
placeholder: '', placeholder: '',
allowClear: !field.required, allowClear: !field.required,
dropdownParent: $(options.modal), dropdownParent: $(options.modal),
dropdownAutoWidth: false, dropdownAutoWidth: false,
ajax: {
url: field.api_url,
dataType: 'json',
delay: 250, delay: 250,
cache: true, cache: true,
data: function(params) { data: function(params) {
@ -1081,6 +1081,7 @@ function initializeRelatedField(name, field, options) {
} }
if (!data.pk) { if (!data.pk) {
return field.placeholder || '';
return $(searching()); return $(searching());
} }
@ -1171,7 +1172,7 @@ function searching() {
function renderModelData(name, model, data, parameters, options) { function renderModelData(name, model, data, parameters, options) {
if (!data) { if (!data) {
return '{% trans "Searching" %}...'; return parameters.placeholder || '';
} }
// TODO: Implement this function for various models // TODO: Implement this function for various models