Closed sachinkhot02 closed 9 years ago
+1
Hello. I have the same issue. I commented out all lines related to 'previousSearchText' in 'filterData()' and it started working correctly.
If you need temporary workaround it should help:
function filterData() {
var itemCount = $scope.allItems.length;
// If search text is blank OR paging is enabled && current number of items is >= pageSize (or zero)
if ($scope.searchText === "" || ($scope.settings.pageSize && (itemCount >= $scope.settings.pageSize || itemCount === 0))) {
// Data needs to be re-loaded.
$scope.allDataLoaded = false;
}
var itemsToFilter = $scope.allItems;
if ($scope.settings.filterType == "contains") {
$scope.items = $filter("filter")(itemsToFilter, function (item) {
// Check for match at start of items only
return item.text.toLowerCase().indexOf($scope.searchText.toLowerCase()) > -1;
});
}
else {
$scope.items = $filter("filter")(itemsToFilter, function (item) {
// Check for match at start of items only
return item.text.substr(0, $scope.searchText.length).toLowerCase() === $scope.searchText.toLowerCase();
});
}
// Update indexes
angular.forEach($scope.items, function (item, index) {
item.index = index;
});
checkItemCount();
$scope.previousSearchText = $scope.searchText;
$scope.setListHeight();
}
@ryletko - good work finding that workaround. Had a bunch of other changes I needed to commit, but I'll start working on a fix for this tomorrow.
@ryletko ..thanks dude..it works.
This is now fixed.
in the dropdown .. I am able to find data with the search text box only once.. after that it does not filter or search the data with the provided search text..whats the problem i dont understand?