From c9ea33e22e624bf59d08284f97cd2751bd9d1001 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 23 Apr 2020 10:58:26 +1000 Subject: [PATCH] Fix order of javascript table events --- InvenTree/order/templates/order/sales_order_detail.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/InvenTree/order/templates/order/sales_order_detail.html b/InvenTree/order/templates/order/sales_order_detail.html index 24c1c93929..e11956214e 100644 --- a/InvenTree/order/templates/order/sales_order_detail.html +++ b/InvenTree/order/templates/order/sales_order_detail.html @@ -45,6 +45,7 @@ $("#so-lines-table").inventreeTable({ allocations: true, }, url: "{% url 'api-so-line-list' %}", + onPostBody: setupCallbacks, detailViewByClick: true, detailView: true, detailFilter: function(index, row) { @@ -201,10 +202,9 @@ function reloadTable() { $("#so-lines-table").bootstrapTable("refresh"); } -// Called when the table is loaded -$("#so-lines-table").on('load-success.bs.table', function() { +function setupCallbacks(table) { - var table = $(this); + var table = $("#so-lines-table"); // Set up callbacks for the row buttons table.find(".button-edit").click(function() { @@ -255,7 +255,6 @@ $("#so-lines-table").on('load-success.bs.table', function() { }, }); }); - -}); +} {% endblock %} \ No newline at end of file