aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/static/new/javascript/auto_hide_column.js
blob: 1a4dc03911f346ebbaf00a3f535aadbe71a62a0e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    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 (allNAs){
                invalidColumns.push(col)
            }
        }
        return datatable.columns(invalidColumns).visible(false);

    }