mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
* 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 (cherry picked from commit 717a6ba5d209a1d546a60aa7329f40222c6d4437)
This commit is contained in:
parent
93b51db089
commit
44f26d8e80
@ -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…
x
Reference in New Issue
Block a user