Ion refresher work first time only


#1

I am using ion refresher to refresh my list by getting new results from database but it work first time. If I use it again it does not show the refreshing text etc either and my list is stuck on 5 items as defined in load more for as starting number of items to show. Attached are the pics


#2

Hmm I just tried this with this codepen

and couldn’t reproduce the issue. Could you post a sample of this?


#3

Thanks very much for your reply. The code is little convoluted so I would like to post the code here and see if I could be pointed to something. If that does not help I will attempt to set it at codepen.

    //*** save search results in object
    $scope.setSearchResults = function(results){
        //*** set the list clear before new results are displayed
        $scope.setListClean();
        
        //*** save the search in an object for rendering on back page
        LG.setLgvObj('searchObj',{results: results});

        //*** set the search key in local storage
        localStorage.searchKey = $scope.searchKey;
        
        //*** set patient var in scope
        $scope.patients = results;

    }

    //*** do a fresh search
    $scope.search = function () {
        if ($scope.searchType === "Name") {
			DB.findByName($scope.searchKey).then(function (results) {
				$scope.setSearchResults(results);
			});
        
		} else if ($scope.searchType === "Photo" && $scope.searchKey) {
			DB.findByTag($scope.searchKey).then(function (results) {
				$scope.setSearchResults(results);
			});
        
		} else if ($scope.searchType === "Diagnosis" && $scope.searchKey) {
			DB.findByDiagnosis($scope.searchKey).then(function (results) {
				$scope.setSearchResults(results);
			});
		}
        
	}
    
     //*** function to be called by the infinite scroll directive
     $scope.loadMore = function(){
        $scope.itemLimit += 5;

        //***set the cache object again with new itemLimit value for scroll position to be determined on back
        localStorage.itemLimit = $scope.itemLimit;
        
        //*** we set the DOM limit to max of 30 or the limit of results
        $scope.itemLimit == 30 || $scope.itemLimit > $scope.patients.length ? $scope.noMoreItems = true : $scope.noMoreItems = false;
        U.log($scope.patients.length+" total items and loaded items : "+$scope.itemLimit);
        
        $scope.$broadcast('scroll.infiniteScrollComplete');
    };

    $scope.setListClean = function(){
        $scope.patients = '';
        $scope.itemLimit = 0;
        $scope.noMoreItems = false;
        $ionicScrollDelegate.scrollTop();
    }

$scope.search is the function I call from ion refresher