mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Merge pull request #93 from inventree/pagination-fixes
Fix "related field" in API forms
This commit is contained in:
commit
9c091fee21
2 changed files with 18 additions and 3 deletions
|
|
@ -558,6 +558,9 @@ class APIFormField {
|
|||
popupItemBuilder: (context, item, isSelected) {
|
||||
return _renderRelatedField(item, isSelected, true);
|
||||
},
|
||||
emptyBuilder: (context, item) {
|
||||
return _renderEmptyResult();
|
||||
},
|
||||
onSaved: (item) {
|
||||
if (item != null) {
|
||||
data["value"] = item["pk"];
|
||||
|
|
@ -650,9 +653,21 @@ class APIFormField {
|
|||
subtitle: Text("Model '${model}' rendering not supported"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Construct a widget to instruct the user that no results were found
|
||||
Widget _renderEmptyResult() {
|
||||
return ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.search),
|
||||
title: Text(L10().noResults),
|
||||
subtitle: Text(
|
||||
L10().queryNoResults,
|
||||
style: TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Construct a string input element
|
||||
Widget _constructString() {
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||
|
||||
int pk = location?.pk ?? -1;
|
||||
|
||||
if (pk <= 0) {
|
||||
if (location != null && pk <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||
context,
|
||||
L10().stockItemCreate,
|
||||
data: {
|
||||
"location": pk,
|
||||
"location": location != null ? pk : null,
|
||||
},
|
||||
onSuccess: (result) async {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue