From 6b9627b7b3559a64c5523bad8b5b376ae786a69b Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 8 Dec 2020 04:40:52 +0300 Subject: refactor filter datatable function --- .../static/new/javascript/auto_hide_column.js | 43 ++++++++++------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/auto_hide_column.js b/wqflask/wqflask/static/new/javascript/auto_hide_column.js index 94bb8a90..f879e0d1 100644 --- a/wqflask/wqflask/static/new/javascript/auto_hide_column.js +++ b/wqflask/wqflask/static/new/javascript/auto_hide_column.js @@ -1,28 +1,23 @@ -function filterDatable(datatable){ - let visitedColumns=[] - let columnCount=datatable.columns().header().length; - let numberOfRows=datatable.data().length; - for (let i=0;ivisitedColumns.indexOf(item)<0); - return datatable.columns(emptyColumns).visible(false); + } + emptyColumns=Array.from(Array(columnCount).keys()).filter((item)=>visitedFoundColumns.indexOf(item)<0); + return datatable.columns(emptyColumns).visible(false); -} +} \ No newline at end of file -- cgit v1.2.3