From 2bf80efc0926f676dc3aba35f58e01692f225e1a Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 23 May 2019 23:18:35 +1000 Subject: [PATCH] Display total part quantity in BOM footer - https://stackoverflow.com/questions/45190917/bootstrap-table-footer-functions-not-working-data-footer-formatter --- InvenTree/static/script/inventree/bom.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/InvenTree/static/script/inventree/bom.js b/InvenTree/static/script/inventree/bom.js index a995fe0ed8..e338d80214 100644 --- a/InvenTree/static/script/inventree/bom.js +++ b/InvenTree/static/script/inventree/bom.js @@ -121,7 +121,16 @@ function loadBomTable(table, options) { } return text; - } + }, + footerFormatter: function(data) { + var quantity = 0; + + data.forEach(function(item) { + quantity += item.quantity; + }); + + return quantity; + }, } ); @@ -195,6 +204,7 @@ function loadBomTable(table, options) { search: true, formatNoMatches: function() { return "No BOM items found"; }, clickToSelect: true, + showFooter: true, queryParams: function(p) { return { part: options.parent_id,