← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21316: tracker-capture: better interation during simple search

 

------------------------------------------------------------
revno: 21316
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-12-04 09:34:15 +0100
message:
  tracker-capture: better interation during simple search
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.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-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-12-03 17:02:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-12-04 08:34:15 +0000
@@ -212,7 +212,7 @@
    
     //$scope.searchParam = {bools: []};
     $scope.search = function(mode){  
-        resetParams()
+        resetParams();
         var grid = TEIGridService.generateGridColumns($scope.attributes, $scope.selectedOuMode.name);
         $scope.gridColumns = grid.columns;
             
@@ -223,22 +223,26 @@
         }        
         
         //check search mode
-        if( $scope.selectedSearchMode === $scope.searchMode.freeText ){     
-
-            if(!$scope.searchText){                
-                $scope.emptySearchText = true;
-                $scope.teiFetched = false;
-                return;
-            }       
-            
-            $scope.queryUrl = 'query=LIKE:' + $scope.searchText;            
+        if( $scope.selectedSearchMode === $scope.searchMode.freeText ){
+            
+            if($scope.searchText){
+                $scope.queryUrl = 'query=LIKE:' + $scope.searchText;
+            }
+            else{
+                if(!$scope.selectedProgram || !$scope.selectedProgram.displayFrontPageList){
+                    $scope.emptySearchText = true;
+                    $scope.teiFetched = false;
+                    return;
+                }
+            }            
+            
             $scope.attributes = EntityQueryFactory.resetAttributesQuery($scope.attributes, $scope.enrollment);
             $scope.searchingOrgUnit = $scope.selectedOrgUnit;
         }
         
         if( $scope.selectedSearchMode === $scope.searchMode.attributeBased ){
             
-            $scope.searchText = '';
+            $scope.searchText = null;
             
             $scope.attributeUrl = EntityQueryFactory.getAttributesQuery($scope.attributes, $scope.enrollment);
             
@@ -252,7 +256,7 @@
         }
         
         if( $scope.selectedSearchMode === $scope.searchMode.listAll ){
-            $scope.searchText = '';            
+            $scope.searchText = null;            
             $scope.attributes = EntityQueryFactory.resetAttributesQuery($scope.attributes, $scope.enrollment);
             $scope.searchingOrgUnit = $scope.selectedOrgUnit;
         }


Follow ups