mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Parameters table fix (#4120)
* Account for paginated or unpaginated results * Fix data loading when paginated - Server-side paginated data needs to be provided in the correct format - Look at how the original data were provided by the server - Perform a single data load operation at the end
This commit is contained in:
parent
faaed3dc14
commit
717a6ba5d2
@ -1333,7 +1333,8 @@ function loadParametricPartTable(table, options={}) {
|
||||
uniqueId: 'pk',
|
||||
onLoadSuccess: function(response) {
|
||||
|
||||
var data = response.results;
|
||||
// Data may be returned paginated, in which case we preference response.results
|
||||
var data = response.results || response;
|
||||
|
||||
for (var idx = 0; idx < data.length; idx++) {
|
||||
var row = data[idx];
|
||||
@ -1346,8 +1347,14 @@ function loadParametricPartTable(table, options={}) {
|
||||
data[idx] = row;
|
||||
}
|
||||
|
||||
if (response.results) {
|
||||
response.results = data;
|
||||
} else {
|
||||
response = data;
|
||||
}
|
||||
|
||||
// Update the table
|
||||
$(table).bootstrapTable('load', data);
|
||||
$(table).bootstrapTable('load', response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user