mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
select2 fixes
This commit is contained in:
parent
a47948ffe0
commit
07910766b3
@ -981,13 +981,13 @@ function initializeRelatedField(name, field, options) {
|
|||||||
var pageSize = options.pageSize || 25;
|
var pageSize = options.pageSize || 25;
|
||||||
|
|
||||||
select.select2({
|
select.select2({
|
||||||
|
placeholder: '',
|
||||||
|
allowClear: !field.required,
|
||||||
|
dropdownParent: $(options.modal),
|
||||||
|
dropdownAutoWidth: false,
|
||||||
ajax: {
|
ajax: {
|
||||||
url: field.api_url,
|
url: field.api_url,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
placeholder: '',
|
|
||||||
allowClear: !field.required,
|
|
||||||
dropdownParent: $(options.modal),
|
|
||||||
dropdownAutoWidth: false,
|
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user