about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Kabui2020-12-03 00:01:52 +0300
committerAlexander Kabui2020-12-03 00:01:52 +0300
commita57241a160757ac737658b33ea7cc8ad670a0e61 (patch)
treed3ee61ea1a5c3b4cbc43c87cdb864890589145f5
parent83d1dc24e2d527463e6aa7fd79c30e8242a5a312 (diff)
downloadgenenetwork2-a57241a160757ac737658b33ea7cc8ad670a0e61.tar.gz
add hide empty column in table script
-rw-r--r--wqflask/wqflask/static/new/javascript/auto_hide_column.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/wqflask/wqflask/static/new/javascript/auto_hide_column.js b/wqflask/wqflask/static/new/javascript/auto_hide_column.js
new file mode 100644
index 00000000..652b2ad7
--- /dev/null
+++ b/wqflask/wqflask/static/new/javascript/auto_hide_column.js
@@ -0,0 +1,22 @@
+
+$(function (){
+$("table th").each(function(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(j,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