← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7246: (patient) Fill filter-values into the filter fields of columns when clicking on Update button.

 

------------------------------------------------------------
revno: 7246
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-08 13:28:04 +0700
message:
  (patient) Fill filter-values into the filter fields of columns when clicking on Update button.
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	2012-06-08 05:10:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-06-08 06:28:04 +0000
@@ -804,6 +804,27 @@
 				}
 			})
 		},
+		getFilterValues: function()
+		{
+			var grid = TR.datatable.datatable;
+			
+			var filters = grid.filters.getFilterData();
+			for( var i=0; i<filters.length; i++ )
+			{
+				var filter = filters[i];
+				
+				var compare = '=';
+				if( filter.data.comparison == 'lt')
+					compare = '<' ;
+				else if( filter.data.comparison == 'gt' )
+					compare = '>' ;
+					
+				var value = compare + "'"+ filter.data.value + "'";
+				
+				var record = grid.getView().getRecord( grid.getView().getNode(0) );
+				record.set(filter.field, value);
+			}
+		},
 		getParams: function() {
 			var p = {};
             p.startDate = TR.cmp.settings.startDate.rawValue;
@@ -1214,7 +1235,7 @@
 					encode: true,
 					local: false,
 					buildQuery : function (filters) {
-						for( var i=0;i<filters.length;i++)
+						/* for( var i=0;i<filters.length;i++)
 						{
 							var filter = filters[i];
 							var field = filter.field;
@@ -1229,7 +1250,7 @@
 							var grid = TR.datatable.datatable;
 							var record = grid.getView().getRecord( grid.getView().getNode(0) );
 							record.set(field, value);
-						}
+						} */
 						TR.exe.filter();
 					},
 					filters: []
@@ -1406,6 +1427,7 @@
 					dataIndex: 'col' + index,
 					name: id,
 					hidden: eval(TR.value.columns[index].hidden ),
+					menuFilterText: TR.value.filter,
 					sortable: false,
 					draggable: true,
 					isEditAllowed: true,
@@ -1438,6 +1460,7 @@
 				dataIndex: 'col' + index,
 				name: id,
 				hidden: eval(TR.value.columns[index].hidden ),
+				menuFilterText: TR.value.filter,
 				sortable: false,
 				draggable: true,
 				isEditAllowed: true,