aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorAlexander Kabui2020-12-09 17:32:11 +0300
committerAlexander Kabui2020-12-09 17:32:11 +0300
commit4e3537b9e7525ea7a886cd12205bc40a53c5046a (patch)
tree53c5a0ed000874722fa331e7675f815581f821e4 /wqflask
parenteb5853e2327e399bd012c2ac085754cbb3db0bfb (diff)
downloadgenenetwork2-4e3537b9e7525ea7a886cd12205bc40a53c5046a.tar.gz
add changes to auto_hide_column
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/auto_hide_column.js36
1 files changed, 17 insertions, 19 deletions
diff --git a/wqflask/wqflask/static/new/javascript/auto_hide_column.js b/wqflask/wqflask/static/new/javascript/auto_hide_column.js
index 2fc89786..1a4dc039 100644
--- a/wqflask/wqflask/static/new/javascript/auto_hide_column.js
+++ b/wqflask/wqflask/static/new/javascript/auto_hide_column.js
@@ -1,23 +1,21 @@
-function filterDatatable(datatable){
- let visitedFoundColumns=[]
- let columnCount=datatable.columns().header().length;
- let numberOfRows=datatable.data().length;
- for (let i=0;i<numberOfRows;i++){
- if (visitedFoundColumns.length==columnCount){
- break;
- }
- let rowObj=datatable.rows(i).data()[0]
- for(let col=0;col<rowObj.length;col++){
- if (visitedFoundColumns.length==columnCount){
- break;
+ function filterDatatable(datatable){
+ let invalidColumns=[]
+ let columnCount=datatable.columns().header().length;
+ let numberOfRows=datatable.rows().count();
+ for (let col=0; col<columnCount; col++){
+ colObj = datatable.column(col).nodes().to$();
+ allNAs = true;
+ for (let i=0;i<numberOfRows;i++){
+ cellContent = colObj[i].childNodes[0].data
+ if (cellContent != "N/A" && cellContent != ""){
+ allNAs = false;
+ break;
+ }
}
- if (visitedFoundColumns.includes(col) || rowObj[col]=="N/A"||rowObj[col]==""){
- continue;
+ if (allNAs){
+ invalidColumns.push(col)
}
- visitedFoundColumns.push(col)
}
- }
- emptyColumns=Array.from(Array(columnCount).keys()).filter((column)=>visitedFoundColumns.indexOf(column)<0);
- return datatable.columns(emptyColumns).visible(false);
+ return datatable.columns(invalidColumns).visible(false);
-} \ No newline at end of file
+ } \ No newline at end of file