← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6757: (patient)Add filter buttons for Tabular report.

 

------------------------------------------------------------
revno: 6757
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-26 21:31:07 +0700
message:
  (patient)Add filter buttons for Tabular report.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  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


--
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/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-04-20 10:24:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-04-26 14:31:07 +0000
@@ -330,4 +330,6 @@
 et_no_program = Please select one program
 asc = ASC
 desc = DESC
-show_hide_columns = Show / Hide columns
\ No newline at end of file
+show_hide_columns = Show / Hide columns
+favorites = Favorites
+manage_favorites = Manage favorites
\ No newline at end of file

=== 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-25 07:18:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-04-26 14:31:07 +0000
@@ -961,12 +961,65 @@
 				viewConfig: {
 					getRowClass: function(record, rowIndex, rp, ds){ 
 						if(rowIndex == 0){
-							return 'filter-row';
+							return 'filter-row hidden';
 						} else {
 						   return '';
 						}
 					}
 				},
+				tbar: [
+					{
+						xtype: 'button',
+						text: TR.i18n.filter,
+						handler: function() {
+							var grid = TR.datatable.datatable;
+							var hidden = grid.getView().getNode(0).classList.contains('hidden');
+							if( hidden )
+							{
+								grid.getView().getNode(0).classList.remove('hidden');
+								var record = grid.getView().getRecord( grid.getView().getNode(0) );
+								grid.getView().getSelectionModel().select(record, false, true);
+							}
+							else {
+								TR.exe.execute();
+							}
+						}
+					},
+					{
+						xtype: 'button',
+						text: TR.i18n.clear_filter,
+						handler: function() {
+							var cols = [];
+							var grid = TR.datatable.datatable;
+							var i = 0;
+							for( var index=0; index<grid.columns.length; index++)
+							{
+								var col = grid.columns[index];
+								
+								cols[i] = col;
+								i++;
+								
+								var subCols = col.items;
+								for( var subIndex=0; subIndex<subCols.length; subIndex++)
+								{
+									cols[i] = subCols.getAt(subIndex);
+									i++;
+								}
+							}
+							
+							var editor = grid.getStore().getAt(0);
+							var colLen = cols.length;
+							for( var i=1; i<colLen; i++ )
+							{
+								var col = cols[i];
+								var dataIndex = col.dataIndex;
+								TR.store.datatable.first().data[dataIndex] = "";
+							}
+							
+							TR.exe.execute();
+						}
+					}
+				],
 				bbar: [
 					{
 						xtype: 'button',
@@ -1057,7 +1110,6 @@
 					  Ext.create('Ext.grid.plugin.RowEditing', {
 						clicksToEdit: 1,
 						editStyle: 'row',
-						clicksToMoveEditor: 1,
 						autoScroll: true,
 						errorSummary: false,
 						listeners: {
@@ -1076,43 +1128,8 @@
 					})
 				],
 				store: TR.store.datatable
-				,listeners: {
-					cellclick: function ( o, idx, colIdx, e ) {
-						if ( e.index == 0 && colIdx == 1 )
-						{
-							var cols = [];
-							var grid = TR.datatable.datatable;
-							var i = 0;
-							for( var index=0; index<grid.columns.length; index++)
-							{
-								var col = grid.columns[index];
-								
-								cols[i] = col;
-								i++;
-								
-								var subCols = col.items;
-								for( var subIndex=0; subIndex<subCols.length; subIndex++)
-								{
-									cols[i] = subCols.getAt(subIndex);
-									i++;
-								}
-							}
-							
-							var editor = grid.getStore().getAt(0);
-							var colLen = cols.length;
-							for( var i=1; i<colLen; i++ )
-							{
-								var col = cols[i];
-								var dataIndex = col.dataIndex;
-								TR.store.datatable.first().data[dataIndex] = "";
-							}
-							
-							TR.exe.execute();
-						}
-					}
-				}
 			});
-			
+										
 			if (Ext.grid.RowEditor) {
 				Ext.apply(Ext.grid.RowEditor.prototype, {
 					saveBtnText : TR.i18n.filter,

=== 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-25 07:18:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2012-04-26 14:31:07 +0000
@@ -676,15 +676,11 @@
     font-style: italic;
 }
 
-#gridTable .x-btn-default-small
+.visible
 {
-	display: none;
-}
-
-#gridTable .x-grid-row-editor-buttons {
-	display: none;
-}
-
-#gridTable .x-grid-row-editor-buttons-default {
-	display: none;
+	display: block;
+}
+
+.hidden {
+    display: none;
 }