← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9888: (Tabular report) Enable clear-filter function for Aggregate Report.

 

------------------------------------------------------------
revno: 9888
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-25 10:23:27 +0700
message:
  (Tabular report) Enable clear-filter function for Aggregate Report.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.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-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	2013-02-25 03:14:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-02-25 03:23:27 +0000
@@ -1054,8 +1054,8 @@
 								storeProgramStage.load({params: {programId: f.programId}});
 								
 								Ext.getCmp('programStageCombobox').setValue( f.programStageId );
-								
 								TR.cmp.params.organisationunit.treepanel.getSelectionModel().deselectAll();
+				
 								TR.exe.execute();
 							}
 						});
@@ -1854,7 +1854,9 @@
 								TR.value.title = json.title;
 								TR.value.columns = json.columns;
 								TR.value.values = json.items;
+								
 								// Get fields
+								
 								var fields = [];
 								for( var index=0; index < TR.value.columns.length; index++ )
 								{
@@ -1862,7 +1864,15 @@
 								}
 								TR.value.fields = fields;
 								
+								if(TR.cmp.params.dataelement.selected.store.data.length>0){
+									Ext.getCmp('btnClean').enable();
+								}
+								else{
+									Ext.getCmp('btnClean').disable();
+								}
+								
 								// Set data for grid
+								
 								TR.store.getDataTableStore();
 								TR.datatable.getDataTable();
 								TR.datatable.hidePagingBar();
@@ -4377,15 +4387,25 @@
 						id: 'btnClean',
 						disabled: true,
 						handler: function() {
-							TR.cmp.params.dataelement.selected.store.each( function(r) {
-								var deId = r.data.id;
-								var length = Ext.getCmp('p_' + deId).items.length/4;
-								for(var idx=0;idx<length;idx++)
-								{					
-									var id = deId + '_' + idx;
-									Ext.getCmp('filter_' + id).setValue('');
-								}
-							});
+							if(Ext.getCmp('reportTypeGroup').getValue().reportType=='true')
+							{
+							
+								TR.cmp.params.dataelement.selected.store.each( function(r) {
+									var deId = r.data.id;
+									var length = Ext.getCmp('p_' + deId).items.length/4;
+									for(var idx=0;idx<length;idx++)
+									{					
+										var id = deId + '_' + idx;
+										Ext.getCmp('filter_' + id).setValue('');
+									}
+								});
+							}
+							else
+							{
+								TR.store.dataelement.selected.removeAll();
+								Ext.getCmp('filterPanel').removeAll();
+								Ext.getCmp('filterPanel').doLayout();
+							}
 							TR.exe.execute();
 						}
 					},