← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6653: (patient) Don't allow to hide column report-date in tabular report.

 

------------------------------------------------------------
revno: 6653
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-04-20 10:52:46 +0700
message:
  (patient) Don't allow to hide column report-date in tabular report.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm


--
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-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-04-20 01:32:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-04-20 03:52:46 +0000
@@ -557,6 +557,7 @@
 						TR.state.total = json.total;
 						TR.value.valueTypes = json.valueTypes;
 						TR.value.fields = json.fields;
+						TR.value.hidden= json.hidden;
 						TR.value.columns = json.columns;
 						TR.value.values = json.items;
 						
@@ -565,6 +566,9 @@
 							TR.store.getDataTableStore();
 							TR.datatable.getDataTable();
 							TR.datatable.setPagingToolbarStatus();
+							
+							Ext.getCmp('btnReset').enable();
+							
 							TR.util.mask.hideMask();
 						}
 						else
@@ -606,12 +610,21 @@
 				var cols = [];
 				var grid = TR.datatable.datatable;
 				var i = 0;
-				for( var index=1; index<grid.columns.length; index++)
+				for( var index=0; index<grid.columns.length; index++)
 				{
-					var subCols = grid.columns[index].items;
+					var col = grid.columns[index];
+					if( col.name )
+					{
+						cols[i] = col;
+						i++;
+					}
+					var hidden = col.hidden;
+					var subCols = col.items;
 					for( var subIndex=0; subIndex<subCols.length; subIndex++)
 					{
-						cols[i] = subCols.getAt(subIndex);
+						var subCol = subCols.getAt(subIndex);
+						subCol.hidden = hidden ? hidden : subCol.hidden;
+						cols[i] = subCol;
 						i++;
 					}
 				}
@@ -776,6 +789,7 @@
 		valueTypes: [],
 		columns: [],
 		fields: [],
+		hidden: [],
 		values: []
     };
       
@@ -783,24 +797,15 @@
         datatable: null,
 		getDataTable: function() {
 			
+			var index = 1;
+			
 			var paramsLen = TR.cmp.params.identifierType.selected.store.data.length
 						+ TR.cmp.params.patientAttribute.selected.store.data.length
 						+ TR.cmp.params.dataelement.selected.store.data.length;
-			
 			var metaDatatColsLen = TR.value.columns.length - paramsLen ;
-			var index = 2;
 			
 			var dgCols = [];
-			dgCols[0] = { 
-				header: TR.i18n.report_date, 
-				dataIndex: 'col' + index,
-				sortable: true,
-				draggable: false,
-				sortAscText: TR.i18n.asc,
-				sortDescText: TR.i18n.desc
-			};
-			
-			var i = 1;
+			var i = 0;
 			for( index=2; index < metaDatatColsLen; index++ )
 			{
 				dgCols[i] = {
@@ -810,6 +815,7 @@
 					name:"meta_" + index + "_",
 					sortable: false,
 					draggable: false,
+					hidden: eval(TR.value.hidden[index]),
 					sortAscText: TR.i18n.asc,
 					sortDescText: TR.i18n.desc
 				}
@@ -826,6 +832,7 @@
 					width: 150,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "iden_"+ r.data.id + "_",
+					hidden: eval(TR.value.hidden[index]),
 					sortable: false,
 					draggable: true,
 					renderer: function (val) {
@@ -855,6 +862,7 @@
 					width: 150,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "attr_"+ r.data.id + "_",
+					hidden: eval(TR.value.hidden[index]),
 					flex:1,
 					sortable: false,
 					draggable: true,
@@ -894,6 +902,7 @@
 					width: 150,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "de_"+ r.data.id + "_",
+					hidden: eval(TR.value.hidden[index]),
 					flex:1,
 					sortable: false,
 					draggable: true,
@@ -934,10 +943,20 @@
 				height: TR.conf.layout.east_gridcolumn_height,
 				sortable: false,
 				draggable: false,
+				hideable: false,
 				menuDisabled: true
-			}
-			
-			index = 1;
+			};
+			cols[1] = {
+				header: TR.value.columns[1], 
+				dataIndex: 'col1',
+				height: TR.conf.layout.east_gridcolumn_height,
+				name:"meta_1_",
+				sortable: false,
+				draggable: false,
+				hideable: false
+			};
+				
+			index = 2;
 			if( dgCols.length > 0 )
 			{
 				cols[index]={
@@ -1107,20 +1126,6 @@
 						{
 							grid.getView().focusRow(this.rowIndex);
 						}
-					},
-					sortchange: function( ct, column, direction, eOpts )
-					{
-						var sortedStatus = (direction == "DESC") ? false: true;
-						if( column.name.match("^org")=='org' && TR.state.orderByOrgunitAsc != sortedStatus )
-						{
-							TR.state.orderByOrgunitAsc = sortedStatus;
-							TR.exe.execute();
-						}
-						else if ( TR.state.orderByExecutionDateByAsc != sortedStatus )
-						{
-							TR.state.orderByExecutionDateByAsc = (direction == "DESC") ? false: true;
-							TR.exe.execute();
-						}
 					}
 				},
 				sortAscText: TR.i18n.asc,
@@ -2045,7 +2050,9 @@
 							xtype: 'button',
 							cls: 'tr-toolbar-btn-2',
 							text: TR.i18n.reset,
+							id:'btnReset',
 							width: 50,
+							disabled: true,
 							listeners: {
 								click: function() {
 									TR.exe.reset();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2012-04-19 10:02:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2012-04-20 03:52:46 +0000
@@ -54,5 +54,6 @@
 fixed_attributes:'$encoder.jsEscape($i18n.getString( 'fixed_attributes' ) , "'")',
 dynamic_attributes:'$encoder.jsEscape($i18n.getString( 'dynamic_attributes' ) , "'")',
 report:'$encoder.jsEscape($i18n.getString( 'report' ) , "'")',
-demographics:'$encoder.jsEscape($i18n.getString( 'demographics' ) , "'")'
+demographics:'$encoder.jsEscape($i18n.getString( 'demographics' ) , "'")',
+columns:'$encoder.jsEscape($i18n.getString( 'columns' ) , "'")'
 };
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2012-04-19 02:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2012-04-20 03:52:46 +0000
@@ -4,7 +4,7 @@
 	#set ( $metaData = $noHeader - $valueTypes.size())
 	'total': "$total",
 	'valueTypes':[
-		#foreach( $col in $grid.getVisibleHeaders() )
+		#foreach( $col in $grid.getHeaders() )
 			#if ($velocityCount <= $metaData + 1)
 				{
 					"valueType": "textfield",
@@ -41,7 +41,7 @@
 	],
 	'columns':[
 		"id",
-		#foreach( $colName in $grid.getVisibleHeaders() )
+		#foreach( $colName in $grid.getHeaders() )
 			"$colName.name"
 			#if( $velocityCount < $noHeader ),#end
 		#end
@@ -53,6 +53,12 @@
 			#if( $velocityCount < $noHeader ),#end
 		#end
 	],
+	'hidden':[
+		#foreach( $col in $grid.getHeaders() )
+			"$col.hidden"
+			#if( $velocityCount < $noHeader ),#end
+		#end
+	],
 	'items':[
 		{
 			"id":"$i18n.getString( 'filter' )",
@@ -85,6 +91,7 @@
 	'valueTypes':[],
 	'columns':[],
 	'fields':[],
+	'hidden':[],
 	'items':[]
 #end
 }
\ No newline at end of file