Adds footer formatter to stock table (#4528)

Closes https://github.com/inventree/InvenTree/issues/4525
This commit is contained in:
Oliver 2023-03-25 00:35:22 +11:00 committed by GitHub
parent be92a4345c
commit b8b19c60ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1896,6 +1896,18 @@ function loadStockTable(table, options) {
}
return html;
},
footerFormatter: function(data) {
// Display "total" stock quantity of all rendered rows
let total = 0;
data.forEach(function(row) {
if (row.quantity != null) {
total += row.quantity;
}
});
return total;
}
};