mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-11 07:24:15 +00:00
Start of API forms for stock item
This commit is contained in:
@ -179,6 +179,7 @@ function constructChangeForm(fields, options) {
|
||||
// Request existing data from the API endpoint
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: options.params || {},
|
||||
type: 'GET',
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
@ -194,6 +195,17 @@ function constructChangeForm(fields, options) {
|
||||
fields[field].value = data[field];
|
||||
}
|
||||
}
|
||||
|
||||
// An optional function can be provided to process the returned results,
|
||||
// before they are rendered to the form
|
||||
if (options.processResults) {
|
||||
var processed = options.processResults(data, fields, options);
|
||||
|
||||
// If the processResults function returns data, it will be stored
|
||||
if (processed) {
|
||||
data = processed;
|
||||
}
|
||||
}
|
||||
|
||||
// Store the entire data object
|
||||
options.instance = data;
|
||||
|
Reference in New Issue
Block a user