Calculate total allocation data per-row

This commit is contained in:
Oliver Walters 2019-04-30 14:54:42 +10:00
parent aa491e336d
commit b192deb465

View File

@ -103,4 +103,15 @@ function fillAllocationTable(table, parent_row, options) {
], ],
url: "/api/build/item?build=" + options.build + "&part=" + parent_row.sub_part, url: "/api/build/item?build=" + options.build + "&part=" + parent_row.sub_part,
}); });
table.on('load-success.bs.table', function(data) {
var allocated = 0;
var allocationData = table.bootstrapTable('getData');
// Calculate total allocation
for (var i = 0; i < allocationData.length; i++) {
allocated += allocationData[i].quantity;
}
});
} }