← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3633: added filtering to paging-gui.. GetDAtaElementOperandsAction still needs filtering on key

 

------------------------------------------------------------
revno: 3633
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-16 18:08:06 +0200
message:
  added filtering to paging-gui.. GetDAtaElementOperandsAction still needs filtering on key
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js	2011-05-16 15:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js	2011-05-16 16:08:06 +0000
@@ -36,8 +36,8 @@
     option: "<option>${text}</option>",
     option_selected: "<option selected='selected'>${text}</option>",
     pagesize_input: "Page size <input id='${id}' type='text' style='width: 50px;'/>",
-    filter_input: "<input id='${id}' placeholder='Filter'></input>",
-    select_page: "Page <select id='${id}'></select>"
+    filter_input: "<input id='${id}' placeholder='Filter' type='text' style='width: 80%; height: 18px; border: 1px inset #888;' />",
+    select_page: "Page <select id='${id}' style='width: 50px;'></select>"
   }
 
   var methods = {
@@ -56,6 +56,7 @@
         var previous_button_id = id + "_previous_button";
         var $previous_button = $("#" + previous_button_id);
         var filter_input_id = id + "_filter_input";
+        var $filter_input = $("#" + filter_input_id);
         var pagesize_input_id = id + "_pagesize_input";
         var $pagesize_input = $("#" + pagesize_input_id);
 
@@ -111,22 +112,34 @@
       var next_button_id = id + "_next_button";
       var previous_button_id = id + "_previous_button";
       var filter_input_id = id + "_filter_input";
+      var filter_button_id = id + "_filter_button";
       var pagesize_input_id = id + "_pagesize_input";
 
       $select.wrap( $.tmpl(templates.wrapper, { "id": wrapper_id }) );
-      $wrapper = $("#" + wrapper_id);
+      var $wrapper = $("#" + wrapper_id);
+
+      var $filter_div = $("<div/>");
+      $filter_div.css({
+          "padding": "2px",
+          "width": "100%"
+      });
+
+      $filter_div.append( $.tmpl(templates.filter_input, { "id": filter_input_id }) )
+      $filter_div.append( $.tmpl(templates.button, {"id": filter_button_id, "text": "filter" }) );
+
+      $wrapper.prepend( $filter_div );
 
       $wrapper.append( $.tmpl(templates.select_page, { "id": select_page_id }) )
-      $select_page = $("#" + select_page_id);
-
       $wrapper.append( $.tmpl(templates.button, { "id": previous_button_id, "text":"previous" }) );
-      $previous_button = $("#" + previous_button_id);
-
       $wrapper.append( $.tmpl(templates.button, { "id": next_button_id, "text":"next" }) );
-      $next_button = $("#" + next_button_id);
-
       $wrapper.append( $.tmpl(templates.pagesize_input, { "id": pagesize_input_id }) );
-      $pagesize_input = $("#" + pagesize_input_id);
+
+      var $filter_input = $("#" + filter_input_id);
+      var $filter_button = $("#" + filter_button_id);
+      var $select_page = $("#" + select_page_id);
+      var $previous_button = $("#" + previous_button_id);
+      var $next_button = $("#" + next_button_id);
+      var $pagesize_input = $("#" + pagesize_input_id);
 
       settings.params = params;
       $select.data("settings", settings);
@@ -148,6 +161,20 @@
           methods.load("" + id);
       });
 
+      $filter_button.click(function() {
+         params.key = $filter_input.val();
+
+         if(params.key.length === 0) {
+             delete params.key;
+         }
+
+         params.currentPage = 1;
+         settings.params = params;
+         $select.data("settings", settings);
+         
+         methods.load("" + id);
+      });
+      
       $select_page.change(function() {
           params.currentPage = +$(this).find(":selected").val();
           settings.params = params;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js	2011-05-16 15:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js	2011-05-16 16:08:06 +0000
@@ -24,10 +24,10 @@
 
 		// TODO look into this.. firefox does not treat the box-model the same as webkit... 
 		// 		should be fixable by setting fixed paddings/margin somewhere!
-		
-		var adjustment = 96;
-		if($.browser.webkit) adjustment = 96;
-		else if($.browser.mozilla) adjustment = 95;
+
+		var adjustment = 102;
+		if($.browser.webkit) adjustment = 102;
+		else if($.browser.mozilla) adjustment = 102;
 
 		dataElementSelector.height( dialog.height() - adjustment );
 		indicatorSelector.height( dialog.height() - adjustment );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2011-05-16 15:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2011-05-16 16:08:06 +0000
@@ -157,30 +157,12 @@
 <div id="selectionDialog" title="Selection Box">
 <div id="tabs">
 		<table style="width: 100%;">
-			<tr id="dataElementsFilter" style="padding: 0; margin: 0; width: 100%;">
-				<td>
-					<input id="dataElementsFilterInput" placeholder="Filter" type="text" style="width: 100%; height: 18px; border: 1px inset #888; padding: 1px 0 1px 0;" />
-				</td>
-				<td style="padding: 0; margin: 0; width: 20px; height: 20px;">
-					<button id="dataElementsFilterButton" style="width: 20px; height: 20px;">Filter</button>
-				</td>
-			</tr>
-
 			<tr id="dataElementsTab">
 				<td colspan="2">
 					<select id="dataElementSelector" multiple="multiple" style="height: 200px; width: 100%;"></select>
 				</td>
 			</tr>
 
-			<tr id="indicatorsFilter">
-				<td>
-					<input type="text" id="indicatorsFilterInput" placeholder="Filter" style="width: 100%; height: 18px; border: 1px inset #888; padding: 1px 0 1px 0;" />
-				</td>
-				<td style="padding: 0; margin: 0; width: 20px; height: 20px;">
-					<button id="indicatorsFilterButton" style="width: 20px; height: 20px;">Filter</button>
-				</td>
-			</tr>
-
 			<tr id="indicatorsTab">
 				<td colspan="2">
 					<select id="indicatorSelector" multiple="multiple" style="height: 200px; width: 100%;"></select>