diff --git a/InvenTree/InvenTree/static/script/inventree/stock.js b/InvenTree/InvenTree/static/script/inventree/stock.js index 589969faaf..e4582e879e 100644 --- a/InvenTree/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/InvenTree/static/script/inventree/stock.js @@ -42,14 +42,10 @@ function loadStockTable(table, options) { var params = options.params || {}; - table.bootstrapTable({ - sortable: true, - search: true, + console.log('load stock table'); + + table.inventreeTable({ method: 'get', - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], - rememberOrder: true, formatNoMatches: function() { return 'No stock items matching query'; }, @@ -387,15 +383,10 @@ function loadStockTrackingTable(table, options) { } }); - table.bootstrapTable({ - sortable: true, - search: true, + table.inventreeTable({ method: 'get', - rememberOrder: true, queryParams: options.params, columns: cols, - pagination: true, - pageSize: 50, url: options.url, }); diff --git a/InvenTree/InvenTree/static/script/inventree/tables.js b/InvenTree/InvenTree/static/script/inventree/tables.js index 4a129132e0..3b2279e18e 100644 --- a/InvenTree/InvenTree/static/script/inventree/tables.js +++ b/InvenTree/InvenTree/static/script/inventree/tables.js @@ -60,6 +60,7 @@ $.fn.inventreeTable = function(options) { options.sortable = true; options.search = true; + // Callback to save pagination data options.onPageChange = function(number, size) { inventreeSave(varName, size); }; diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index 3471b1283a..3e67c65145 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -62,9 +62,7 @@ InvenTree | Allocate Parts {% else %} - $("#build-list").bootstrapTable({ - search: true, - sortable: true, + $("#build-list").inventreeTable({ }); $("#btn-allocate").click(function() { diff --git a/InvenTree/company/templates/company/detail_part.html b/InvenTree/company/templates/company/detail_part.html index 3a24140464..16d564a9db 100644 --- a/InvenTree/company/templates/company/detail_part.html +++ b/InvenTree/company/templates/company/detail_part.html @@ -45,12 +45,7 @@ }); }); - $("#part-table").bootstrapTable({ - sortable: true, - search: true, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], + $("#part-table").inventreeTable({ formatNoMatches: function() { return "No supplier parts found for {{ company.name }}"; }, queryParams: function(p) { return { diff --git a/InvenTree/company/templates/company/detail_purchase_orders.html b/InvenTree/company/templates/company/detail_purchase_orders.html index 077a107848..8c299cbd4e 100644 --- a/InvenTree/company/templates/company/detail_purchase_orders.html +++ b/InvenTree/company/templates/company/detail_purchase_orders.html @@ -42,9 +42,7 @@ newOrder(); }); - $("#po-table").bootstrapTable({ - search: true, - sortable: true, + $(".po-table").inventreeTable({ }); {% endblock %} diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index c77c705ad5..711ed8eb37 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -32,12 +32,7 @@ InvenTree | Supplier List }); }); - $("#company-table").bootstrapTable({ - sortable: true, - search: true, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], + $("#company-table").inventreeTable({ formatNoMatches: function() { return "No company information found"; }, columns: [ { diff --git a/InvenTree/order/templates/order/po_table.html b/InvenTree/order/templates/order/po_table.html index 16fa462951..0fe41e8efa 100644 --- a/InvenTree/order/templates/order/po_table.html +++ b/InvenTree/order/templates/order/po_table.html @@ -1,4 +1,4 @@ - +
diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 29336b18db..83bd526a96 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -221,9 +221,7 @@ $('#new-po-line').click(function() { }); {% endif %} -$("#po-lines-table").bootstrapTable({ - search: true, - sortable: true, +$("#po-lines-table").inventreeTable({ }); diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index 0e93c6d900..6e6e45cdfd 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -32,8 +32,7 @@ $("#po-create").click(function() { ); }); -$("#po-table").bootstrapTable({ - search: true, +$("#po-table").inventreeTable({ }); {% endblock %} \ No newline at end of file diff --git a/InvenTree/part/templates/part/allocation.html b/InvenTree/part/templates/part/allocation.html index 807251a0d1..21c3413ea0 100644 --- a/InvenTree/part/templates/part/allocation.html +++ b/InvenTree/part/templates/part/allocation.html @@ -29,9 +29,7 @@ {% block js_ready %} - $("#build-table").bootstrapTable({ - search: true, - sortable: true, + $("#build-table").inventreeTable({ columns: [ { title: 'Build', diff --git a/InvenTree/part/templates/part/attachments.html b/InvenTree/part/templates/part/attachments.html index c31db94c3e..1f35535fcd 100644 --- a/InvenTree/part/templates/part/attachments.html +++ b/InvenTree/part/templates/part/attachments.html @@ -89,9 +89,7 @@ }); }); - $("#attachment-table").bootstrapTable({ - search: true, - sortable: true, + $("#attachment-table").inventreeTable({ }); {% endblock %} \ No newline at end of file diff --git a/InvenTree/part/templates/part/build.html b/InvenTree/part/templates/part/build.html index d6510e5123..6f44aded08 100644 --- a/InvenTree/part/templates/part/build.html +++ b/InvenTree/part/templates/part/build.html @@ -31,12 +31,7 @@ }); }); - $("#build-table").bootstrapTable({ - sortable: true, - search: true, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], + $("#build-table").inventreeTable({ queryParams: function(p) { return { part: {{ part.id }}, diff --git a/InvenTree/part/templates/part/orders.html b/InvenTree/part/templates/part/orders.html index d3488bea2d..b3f84735f3 100644 --- a/InvenTree/part/templates/part/orders.html +++ b/InvenTree/part/templates/part/orders.html @@ -26,9 +26,7 @@ {% block js_ready %} {{ block.super }} -$("#po-table").bootstrapTable({ - search: true, - sortable: true, +$("#po-table").inventreeTable({ }); $("#part-order2").click(function() { diff --git a/InvenTree/part/templates/part/params.html b/InvenTree/part/templates/part/params.html index 1ccb9d4da6..f1d575d2b7 100644 --- a/InvenTree/part/templates/part/params.html +++ b/InvenTree/part/templates/part/params.html @@ -44,9 +44,7 @@ {% block js_ready %} {{ block.super }} - $('#param-table').bootstrapTable({ - search: true, - sortable: true, + $('#param-table').inventreeTable({ }); $('#param-create').click(function() { diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html index 35593f3fdc..8d21f6417c 100644 --- a/InvenTree/part/templates/part/supplier.html +++ b/InvenTree/part/templates/part/supplier.html @@ -50,9 +50,7 @@ }); }); - $("#supplier-table").bootstrapTable({ - sortable: true, - search: true, + $("#supplier-table").inventreeTable({ formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; }, queryParams: function(p) { return { diff --git a/InvenTree/part/templates/part/used_in.html b/InvenTree/part/templates/part/used_in.html index 665d7ed58f..872288723e 100644 --- a/InvenTree/part/templates/part/used_in.html +++ b/InvenTree/part/templates/part/used_in.html @@ -16,9 +16,7 @@ {% block js_ready %} {{ block.super }} - $("#used-table").bootstrapTable({ - sortable: true, - search: true, + $("#used-table").inventreeTable({ formatNoMatches: function() { return "{{ part.full_name }} is not used to make any other parts"; }, queryParams: function(p) { return { diff --git a/InvenTree/part/templates/part/variants.html b/InvenTree/part/templates/part/variants.html index fd55029ba5..725a7ba9b4 100644 --- a/InvenTree/part/templates/part/variants.html +++ b/InvenTree/part/templates/part/variants.html @@ -53,9 +53,7 @@ {{ block.super }} - $('#variant-table').bootstrapTable({ - search: true, - sortable: true, + $('#variant-table').inventreeTable({ }); $('#new-variant').click(function() { diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html index 97285ddfd5..fef14b6712 100644 --- a/InvenTree/templates/InvenTree/search.html +++ b/InvenTree/templates/InvenTree/search.html @@ -83,7 +83,7 @@ InvenTree | Search Results onSearchResults('#supplier-part-results-table', '#supplier-part-result-count'); - $("#category-results-table").bootstrapTable({ + $("#category-results-table").inventreeTable({ url: "{% url 'api-part-category-list' %}", queryParams: { search: "{{ query }}", @@ -103,7 +103,7 @@ InvenTree | Search Results ], }); - $("#location-results-table").bootstrapTable({ + $("#location-results-table").inventreeTable({ url: "{% url 'api-location-list' %}", queryParams: { search: "{{ query }}", @@ -134,15 +134,11 @@ InvenTree | Search Results } ); - $("#company-results-table").bootstrapTable({ + $("#company-results-table").inventreeTable({ url: "{% url 'api-company-list' %}", queryParams: { search: "{{ query }}", }, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], - search: true, columns: [ { field: 'name', @@ -158,15 +154,11 @@ InvenTree | Search Results ] }); - $("#supplier-part-results-table").bootstrapTable({ + $("#supplier-part-results-table").inventreeTable({ url: "{% url 'api-part-supplier-list' %}", queryParams: { search: "{{ query }}", }, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], - search: true, columns: [ { field: 'supplier_name', diff --git a/InvenTree/templates/InvenTree/settings/currency.html b/InvenTree/templates/InvenTree/settings/currency.html index dcdafb72ac..4eb9420f05 100644 --- a/InvenTree/templates/InvenTree/settings/currency.html +++ b/InvenTree/templates/InvenTree/settings/currency.html @@ -19,16 +19,11 @@ {% block js_ready %} {{ block.super }} - $("#currency-table").bootstrapTable({ + $("#currency-table").inventreeTable({ url: "{% url 'api-currency-list' %}", queryParams: { ordering: 'suffix' }, - sortable: true, - search: true, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], formatNoMatches: function() { return "No currencies found"; }, rowStyle: function(row, index) { if (row.base) { diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html index 5f624063c1..2bbfaf2b03 100644 --- a/InvenTree/templates/InvenTree/settings/part.html +++ b/InvenTree/templates/InvenTree/settings/part.html @@ -19,16 +19,11 @@ {% block js_ready %} {{ block.super }} - $("#param-table").bootstrapTable({ + $("#param-table").inventreeTable({ url: "{% url 'api-part-param-template-list' %}", queryParams: { ordering: 'name', }, - sortable: true, - search: true, - pagination: true, - pageSize: 50, - pageList: [25, 50, 100, 'all'], formatNoMatches: function() { return "No part parameter templates found"; }, columns: [ {
Company