← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6992: Impl ignore cols for plain table in plugin

 

------------------------------------------------------------
revno: 6992
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-05-19 19:08:08 +0200
message:
  Impl ignore cols for plain table in plugin
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js	2012-05-19 11:33:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js	2012-05-19 17:08:08 +0000
@@ -1138,7 +1138,7 @@
     		DHIS.table.tables[el].destroy();
     	}
     },
-    getDataQuery: function(conf,url) {    	
+    getDataQuery: function(conf, url) {    	
     	Ext.Array.each(conf.indicators, function(item) {
 			url = Ext.String.urlAppend(url, 'in=' + item);
 		});
@@ -1179,7 +1179,7 @@
 		});
 		return headers;
 	},
-	getColumnArray: function(conf,data) {
+	getColumnArray: function(conf, data) {
 		var columns = [];
 		Ext.Array.each(data.headers, function(header, index) {
 			if (!Ext.Array.contains(conf.hiddenCols, index) && !Ext.Array.contains(conf.hiddenCols, header)) {
@@ -1212,14 +1212,16 @@
 };
 
 DHIS.table.plain = {
-	getMarkup: function(data) {
+	getMarkup: function(conf, data) {
 		var html = '<table><tr>';
 		var classMap = []; /* Col index -> class markup */
 		
 		Ext.Array.each(data.headers, function(header, index) {
-			var clazz = !header.meta ? ' class=\"val\"' : '';	
-			classMap[index] = clazz;
-			html += '<th' + clazz + '>' + header.name + '<\/th>';	
+			if (!Ext.Array.contains(conf.hiddenCols, index)) {
+				var clazz = !header.meta ? ' class=\"val\"' : '';	
+				classMap[index] = clazz;
+				html += '<th' + clazz + '>' + header.name + '<\/th>';
+			}	
 		});
 		
 		html += '<\/tr>';
@@ -1227,8 +1229,10 @@
 		Ext.Array.each(data.rows, function(row) {
 			html += '<tr>';
 			Ext.Array.each(row, function(field, index) {
-				var clazz = classMap[index];				
-				html += '<td' + clazz + '>' + field + '<\/td>';
+				if (!Ext.Array.contains(conf.hiddenCols, index)) {
+					var clazz = classMap[index];				
+					html += '<td' + clazz + '>' + field + '<\/td>';
+				}
 			});
 			html += '<\/tr>';
 		});
@@ -1241,7 +1245,7 @@
 			url: DHIS.table.utils.getTableDataUrl(conf),
 			disableCaching: false,
 			success: function(data) {
-				var html = DHIS.table.plain.getMarkup(data);
+				var html = DHIS.table.plain.getMarkup(conf, data);
 				Ext.get(conf.el).update(html);
 			}
 		});

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html	2012-05-19 16:34:10 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html	2012-05-19 17:08:08 +0000
@@ -2,7 +2,7 @@
 <head>
     <link rel="stylesheet" type="text/css" href="../../../dhis-web-commons/javascripts/ext/resources/css/ext-plugin-gray.css" />
     <script type="text/javascript" src="../../../dhis-web-commons/javascripts/ext/ext-all.js"></script>
-    <script type="text/javascript" src="../../../dhis-web-commons/javascripts/plugin/plugin.js"></script>
+    <script type="text/javascript" src="plugin.js"></script>
 	
     <style type="text/css">
 		body {font-family: sans-serif; margin: 0 0 0 60px;}
@@ -81,6 +81,7 @@
 				orgunits: ['ImspTQPwCqd'],
 				crosstab: ['periods'],
 				orgUnitIsParent: true,
+				hiddenCols: [0],
 				useExtGrid: false,
 				el: 'table1',
 				url: url

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js	2012-05-19 11:33:16 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js	2012-05-19 17:08:08 +0000
@@ -1138,7 +1138,7 @@
     		DHIS.table.tables[el].destroy();
     	}
     },
-    getDataQuery: function(conf,url) {    	
+    getDataQuery: function(conf, url) {    	
     	Ext.Array.each(conf.indicators, function(item) {
 			url = Ext.String.urlAppend(url, 'in=' + item);
 		});
@@ -1179,7 +1179,7 @@
 		});
 		return headers;
 	},
-	getColumnArray: function(conf,data) {
+	getColumnArray: function(conf, data) {
 		var columns = [];
 		Ext.Array.each(data.headers, function(header, index) {
 			if (!Ext.Array.contains(conf.hiddenCols, index) && !Ext.Array.contains(conf.hiddenCols, header)) {
@@ -1212,14 +1212,16 @@
 };
 
 DHIS.table.plain = {
-	getMarkup: function(data) {
+	getMarkup: function(conf, data) {
 		var html = '<table><tr>';
 		var classMap = []; /* Col index -> class markup */
 		
 		Ext.Array.each(data.headers, function(header, index) {
-			var clazz = !header.meta ? ' class=\"val\"' : '';	
-			classMap[index] = clazz;
-			html += '<th' + clazz + '>' + header.name + '<\/th>';	
+			if (!Ext.Array.contains(conf.hiddenCols, index)) {
+				var clazz = !header.meta ? ' class=\"val\"' : '';	
+				classMap[index] = clazz;
+				html += '<th' + clazz + '>' + header.name + '<\/th>';
+			}	
 		});
 		
 		html += '<\/tr>';
@@ -1227,8 +1229,10 @@
 		Ext.Array.each(data.rows, function(row) {
 			html += '<tr>';
 			Ext.Array.each(row, function(field, index) {
-				var clazz = classMap[index];				
-				html += '<td' + clazz + '>' + field + '<\/td>';
+				if (!Ext.Array.contains(conf.hiddenCols, index)) {
+					var clazz = classMap[index];				
+					html += '<td' + clazz + '>' + field + '<\/td>';
+				}
 			});
 			html += '<\/tr>';
 		});
@@ -1241,7 +1245,7 @@
 			url: DHIS.table.utils.getTableDataUrl(conf),
 			disableCaching: false,
 			success: function(data) {
-				var html = DHIS.table.plain.getMarkup(data);
+				var html = DHIS.table.plain.getMarkup(conf, data);
 				Ext.get(conf.el).update(html);
 			}
 		});