From 9d39d5b00f22e5eef7e0ffa6cb6a0f00b926a7f1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 22 Oct 2022 14:16:55 +1100 Subject: [PATCH] Improve redraw speed of build allocation table (#3831) - Reload table data in one go, rather than one row at a time - Reduces redraw time (in one example) from ~4s to ~0.05s --- InvenTree/templates/js/translated/build.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js index fa1ec5bab4..223372a767 100644 --- a/InvenTree/templates/js/translated/build.js +++ b/InvenTree/templates/js/translated/build.js @@ -1471,13 +1471,16 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { // How many rows are fully allocated? var allocated_rows = 0; - bom_items.forEach(function(row) { - $(table).bootstrapTable('updateByUniqueId', row.pk, row, true); + for (var idx = 0; idx < bom_items.length; idx++) { + var row = bom_items[idx]; if (isRowFullyAllocated(row)) { - allocated_rows += 1; + allocated_rows++; } - }); + } + + // Reload table data + $(table).bootstrapTable('load', bom_items); // Find the top-level progess bar for this build output var output_progress_bar = $(`#output-progress-${outputId}`);