← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6829: Add sort-by button for tabular report

 

------------------------------------------------------------
revno: 6829
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-02 15:49:03 +0700
message:
  Add sort-by button for tabular report
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-asc.gif
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-desc.gif
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/app/css/style.css
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.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-28 11:26:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-05-02 08:49:03 +0000
@@ -374,7 +374,19 @@
 				item.setValue(false);
 				item.disable();
 			});
-		}
+		},
+		getSelectedFixedAttr: function()
+		{
+			var p = [];
+			var fixedAttributes = TR.cmp.params.fixedAttributes.checkbox;
+			Ext.Array.each(fixedAttributes, function(item) {
+				if( item.value )
+				{
+					p.fixedAttributes.push( item.paramName );
+				}
+			});
+			return p;
+		},
 	};
     
     TR.store = {
@@ -546,6 +558,7 @@
 							Ext.getCmp('btnReset').enable();
 							Ext.getCmp('btnFilter').enable();
 							Ext.getCmp('btnClean').enable();
+							Ext.getCmp('btnSortBy').enable();
 							
 							TR.util.mask.hideMask();
 						}
@@ -574,12 +587,12 @@
 			p.currentPage = this.currentPage;
 			
 			// Get fixed attributes
-			p.fixedAttributes = [];
-			var fixedAttributes = TR.cmp.params.fixedAttributes.checkbox;
+			p.fixedAttributes = TR.util.getSelectedFixedAttr();
+			/*var fixedAttributes = TR.cmp.params.fixedAttributes.checkbox;
 			Ext.Array.each(fixedAttributes, function(item) {
 				if( item.value )
 					p.fixedAttributes.push( item.paramName );
-			});
+			});*/
 			
 			// Get searching values
 			p.searchingValues = [];
@@ -808,9 +821,7 @@
 					name:"meta_" + index + "_",
 					sortable: false,
 					draggable: false,
-					hidden: eval(TR.value.hidden[index]),
-					sortAscText: TR.i18n.asc,
-					sortDescText: TR.i18n.desc
+					hidden: eval(TR.value.hidden[index])
 				}
 			}
 			
@@ -1968,6 +1979,44 @@
 					},
 					{
 						xtype: 'button',
+						text: TR.i18n.sort_by,
+						id: 'btnSortBy',
+						disabled: true,
+						execute: function() {
+							TR.exe.execute();
+						},
+						listeners: {
+							afterrender: function(b) {
+								this.menu = Ext.create('Ext.menu.Menu', {
+									margin: '2 0 0 0',
+									shadow: false,
+									showSeparator: false,
+									items: [
+										{
+											text: TR.i18n.asc,
+											iconCls: 'tr-menu-item-asc',
+											minWidth: 105,
+											handler: function() {
+												TR.state.orderByOrgunitAsc = "true";
+												b.execute();
+											}
+										},
+										{
+											text: TR.i18n.desc,
+											iconCls: 'tr-menu-item-desc',
+											minWidth: 105,
+											handler: function() {
+												TR.state.orderByOrgunitAsc = "false";
+												b.execute();
+											}
+										}
+									]                                            
+								});
+							}
+						}
+					},
+					{
+						xtype: 'button',
 						cls: 'tr-toolbar-btn-2',
 						text: TR.i18n.reset,
 						id:'btnReset',

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2012-04-27 10:44:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2012-05-02 08:49:03 +0000
@@ -709,4 +709,11 @@
 {
     display:none;
 }
-  
\ No newline at end of file
+  
+.tr-menu-item-asc {
+    background-image:url('../images/hmenu-asc.gif');
+}
+
+.tr-menu-item-desc {
+    background-image:url('../images/hmenu-desc.gif');
+}

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-asc.gif'
Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-asc.gif	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-asc.gif	2012-05-02 08:49:03 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-desc.gif'
Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-desc.gif	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/hmenu-desc.gif	2012-05-02 08:49:03 +0000 differ
=== 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-28 11:26:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2012-05-02 08:49:03 +0000
@@ -68,5 +68,5 @@
 save:'$encoder.jsEscape($i18n.getString( 'save' ) , "'")',
 save_favorite:'$encoder.jsEscape($i18n.getString( 'save_favorite' ) , "'")',
 overwrite:'$encoder.jsEscape($i18n.getString( 'overwrite' ) , "'")',
-et_no_programs: '$encoder.jsEscape($i18n.getString( 'et_no_programs' ) , "'")'
+et_no_programs: '$encoder.jsEscape($i18n.getString( 'et_no_programs' ) , "'")',
 };
\ No newline at end of file