mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix rendering during search
This commit is contained in:
parent
9312a5d3b4
commit
f18c2a7a3d
@ -729,6 +729,10 @@ function initializeRelatedField(name, field, options) {
|
|||||||
data = item.element.instance;
|
data = item.element.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data.pk) {
|
||||||
|
return $(searching());
|
||||||
|
}
|
||||||
|
|
||||||
// Custom formatting for the search results
|
// Custom formatting for the search results
|
||||||
if (field.model) {
|
if (field.model) {
|
||||||
// If the 'model' is specified, hand it off to the custom model render
|
// If the 'model' is specified, hand it off to the custom model render
|
||||||
@ -750,6 +754,10 @@ function initializeRelatedField(name, field, options) {
|
|||||||
data = item.element.instance;
|
data = item.element.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data.pk) {
|
||||||
|
return $(searching());
|
||||||
|
}
|
||||||
|
|
||||||
// Custom formatting for selected item
|
// Custom formatting for selected item
|
||||||
if (field.model) {
|
if (field.model) {
|
||||||
// If the 'model' is specified, hand it off to the custom model render
|
// If the 'model' is specified, hand it off to the custom model render
|
||||||
@ -794,6 +802,11 @@ function initializeRelatedField(name, field, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Render a 'no results' element
|
||||||
|
function searching() {
|
||||||
|
return `<span>{% trans "Searching" %}...</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Render a "foreign key" model reference in a select2 instance.
|
* Render a "foreign key" model reference in a select2 instance.
|
||||||
* Allows custom rendering with access to the entire serialized object.
|
* Allows custom rendering with access to the entire serialized object.
|
||||||
|
Loading…
Reference in New Issue
Block a user