mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Reimplement instance data
This commit is contained in:
parent
ce31d968b3
commit
80b203ce7b
@ -71,10 +71,10 @@ class APIFormField {
|
||||
*
|
||||
* - First the user-provided data is checked
|
||||
* - Second, the server-provided definition is checked
|
||||
* - Third, return null
|
||||
*
|
||||
* - Finally, return null
|
||||
*/
|
||||
dynamic getParameter(String key) {
|
||||
|
||||
if (data.containsKey(key)) {
|
||||
return data[key];
|
||||
} else if (definition.containsKey(key)) {
|
||||
@ -107,7 +107,7 @@ class APIFormField {
|
||||
bool get multiline => (getParameter("multiline") ?? false) as bool;
|
||||
|
||||
// Get the "value" as a string (look for "default" if not available)
|
||||
dynamic get value => getParameter("value") ?? data["default"];
|
||||
dynamic get value => data["value"] ?? data["instance_value"] ?? data["default"];
|
||||
|
||||
// Get the "default" as a string
|
||||
dynamic get defaultValue => getParameter("default");
|
||||
@ -756,6 +756,9 @@ Future<void> launchApiForm(
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add instance value to the field
|
||||
field.data["instance_value"] = modelData[fieldName];
|
||||
|
||||
formFields.add(field);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user