aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2020-12-03 00:47:54 +0300
committerAlexander Kabui2020-12-03 00:47:54 +0300
commitf199a59587bad2b20c4122562eb707931b045669 (patch)
tree3197ba4e4f00d1e75d68961af0c51e6fe39ba69c
parent8746f2e93fe889ac0ba9e801b3684764fffa2945 (diff)
downloadgenenetwork2-f199a59587bad2b20c4122562eb707931b045669.tar.gz
add support for multiple tables
-rw-r--r--wqflask/wqflask/static/new/javascript/auto_hide_column.js37
1 files changed, 18 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 73b639dc..14348ccd 100644
--- a/wqflask/wqflask/static/new/javascript/auto_hide_column.js
+++ b/wqflask/wqflask/static/new/javascript/auto_hide_column.js
@@ -1,22 +1,21 @@
+$(function(){
+ $("table").each(function(table){
+ $(this).find("th").each(function(col_index,col_th){
+ var filter_counter=0
+ var col_td=$(this).closest('table').find('tr td:nth-child(' + (col_index + 1) + ')')
+ col_td.each(function(td_index,col_td){
+ if(this.innerHTML==""||this.innerHTML=="N/A"){
+ filter_counter+=1
+ }
+ else{
+ return false
+ }
+ })
+ if (filter_counter==$(this).closest("table").find("tr").length-1){
+ $(this).hide();
+ col_td.hide();
-$(function (){
-$("table th").each(function(th_index,col_th){
- var filter_counter = 0;
- // map each column to row ie column i to ith element
- var column_tds = $(this).closest('table').find('tr td:nth-child(' + (index + 1) + ')')
- column_tds.each(function(td_index,col_td){
- if(this.innerHTML==''||this.innerHTML=="N/A"){
- filter_counter+=1;
- }
- else{
- // break
- return false;
- }
+ }
+ })
})
- if (filter_counter == ($('table tr').length - 1)){
- $(this).hide();
- column_tds.hide();
-
- }
})
-}) \ No newline at end of file