From 2046c126008bebc72f5df141e7321798da1757f9 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 22 Sep 2019 21:56:57 +1000 Subject: [PATCH] Use a jQuerified function --- InvenTree/InvenTree/static/script/inventree/part.js | 2 +- InvenTree/InvenTree/static/script/inventree/tables.js | 5 ++--- InvenTree/build/templates/build/index.html | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/part.js b/InvenTree/InvenTree/static/script/inventree/part.js index ec4b77eead..0904c22a0d 100644 --- a/InvenTree/InvenTree/static/script/inventree/part.js +++ b/InvenTree/InvenTree/static/script/inventree/part.js @@ -191,7 +191,7 @@ function loadPartTable(table, url, options={}) { } }); - inventreeTable(table, { + $(table).inventreeTable({ url: url, sortName: 'name', method: 'get', diff --git a/InvenTree/InvenTree/static/script/inventree/tables.js b/InvenTree/InvenTree/static/script/inventree/tables.js index 8e9d3ccf84..4a129132e0 100644 --- a/InvenTree/InvenTree/static/script/inventree/tables.js +++ b/InvenTree/InvenTree/static/script/inventree/tables.js @@ -47,8 +47,7 @@ function isNumeric(n) { /* Wrapper function for bootstrapTable. * Sets some useful defaults, and manage persistent settings. */ - -function inventreeTable(table, options) { +$.fn.inventreeTable = function(options) { var tableName = options.name || 'table'; @@ -66,7 +65,7 @@ function inventreeTable(table, options) { }; // Standard options for all tables - $(table).bootstrapTable(options); + this.bootstrapTable(options); } function customGroupSorter(sortName, sortOrder, sortData) { diff --git a/InvenTree/build/templates/build/index.html b/InvenTree/build/templates/build/index.html index 3c9eda3544..fb75d0586a 100644 --- a/InvenTree/build/templates/build/index.html +++ b/InvenTree/build/templates/build/index.html @@ -44,9 +44,7 @@ InvenTree | Build List }); }); - $(".build-table").bootstrapTable({ - sortable: true, - search: true, + $(".build-table").inventreeTable({ formatNoMatches: function() { return 'No builds found'; }, columns: [ {