From 9c2e959ab0d9b02b44c925c9547070a47a501861 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 28 Aug 2020 10:50:43 +1000 Subject: [PATCH] Add function to turn a set of visible columns into a settings string for saving to session --- .../InvenTree/static/script/inventree/tables.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/InvenTree/InvenTree/static/script/inventree/tables.js b/InvenTree/InvenTree/static/script/inventree/tables.js index e319aa8440..079eee3724 100644 --- a/InvenTree/InvenTree/static/script/inventree/tables.js +++ b/InvenTree/InvenTree/static/script/inventree/tables.js @@ -80,6 +80,21 @@ function reloadTable(table, filters) { } +function visibleColumnString(columns) { + /* Generate a list of "visible" columns to save to file. */ + + var fields = []; + + columns.forEach(function(column) { + if (column.switchable && column.visible) { + fields.push(column.field); + } + }); + + return fields.join(','); +} + + /* Wrapper function for bootstrapTable. * Sets some useful defaults, and manage persistent settings. */