mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 05:56:47 +00:00
Merge pull request #93 from inventree/pagination-fixes
Fix "related field" in API forms
This commit is contained in:
commit
9c091fee21
@ -558,6 +558,9 @@ class APIFormField {
|
|||||||
popupItemBuilder: (context, item, isSelected) {
|
popupItemBuilder: (context, item, isSelected) {
|
||||||
return _renderRelatedField(item, isSelected, true);
|
return _renderRelatedField(item, isSelected, true);
|
||||||
},
|
},
|
||||||
|
emptyBuilder: (context, item) {
|
||||||
|
return _renderEmptyResult();
|
||||||
|
},
|
||||||
onSaved: (item) {
|
onSaved: (item) {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
data["value"] = item["pk"];
|
data["value"] = item["pk"];
|
||||||
@ -650,9 +653,21 @@ class APIFormField {
|
|||||||
subtitle: Text("Model '${model}' rendering not supported"),
|
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
|
// Construct a string input element
|
||||||
Widget _constructString() {
|
Widget _constructString() {
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
|
|
||||||
int pk = location?.pk ?? -1;
|
int pk = location?.pk ?? -1;
|
||||||
|
|
||||||
if (pk <= 0) {
|
if (location != null && pk <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
context,
|
context,
|
||||||
L10().stockItemCreate,
|
L10().stockItemCreate,
|
||||||
data: {
|
data: {
|
||||||
"location": pk,
|
"location": location != null ? pk : null,
|
||||||
},
|
},
|
||||||
onSuccess: (result) async {
|
onSuccess: (result) async {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user