Commit 4f38b829 by dileep bhimineni

changes for enter button fix on search results page

parent 6b9acc52
...@@ -28,6 +28,9 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -28,6 +28,9 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.itemsPerPage = 10 $scope.itemsPerPage = 10
$scope.totalItems = 40; $scope.totalItems = 40;
$scope.filteredResults = [];
$scope.resultRows = [];
$scope.setPage = function (pageNo) { $scope.setPage = function (pageNo) {
$scope.currentPage = pageNo; $scope.currentPage = pageNo;
}; };
...@@ -45,8 +48,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -45,8 +48,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
var begin = (($scope.currentPage - 1) * $scope.itemsPerPage), var begin = (($scope.currentPage - 1) * $scope.itemsPerPage),
end = begin + $scope.itemsPerPage; end = begin + $scope.itemsPerPage;
$scope.searchTypesAvailable = $scope.typeAvailable(); $scope.searchTypesAvailable = $scope.typeAvailable();
console.log($scope.searchTypesAvailable);
if ($scope.searchTypesAvailable) { if ($scope.searchTypesAvailable) {
$scope.searchMessage = 'searching...'; console.log($scope.searchTypesAvailable);
$scope.searchMessage = 'loading results...';
$scope.filteredResults = $scope.resultRows.slice(begin, end); $scope.filteredResults = $scope.resultRows.slice(begin, end);
$scope.pageCount = function () { $scope.pageCount = function () {
return Math.ceil($scope.resultCount / $scope.itemsPerPage); return Math.ceil($scope.resultCount / $scope.itemsPerPage);
...@@ -61,11 +66,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -61,11 +66,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
} else { } else {
$scope.searchMessage = '0 results matching your search query '+ $scope.query +' were found'; $scope.searchMessage = '0 results matching your search query '+ $scope.query +' were found';
} }
});
$state.go('search.results', {query:query}, { $state.go('search.results', {query:query}, {
location: 'replace' location: 'replace'
}); });
});
}, function searchError(err) { }, function searchError(err) {
NotificationService.error('Error occurred during executing search query, error status code = ' + err.status + ', status text = ' + err.statusText, false); NotificationService.error('Error occurred during executing search query, error status code = ' + err.status + ', status text = ' + err.statusText, false);
...@@ -73,12 +77,16 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -73,12 +77,16 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
}; };
$scope.typeAvailable = function() { $scope.typeAvailable = function() {
console.log($scope.results.dataType);
if($scope.results.dataType) { if($scope.results.dataType) {
return $scope.types.indexOf($scope.results.dataType.typeName && $scope.results.dataType.typeName.toLowerCase()) > -1; return $scope.types.indexOf($scope.results.dataType.typeName && $scope.results.dataType.typeName.toLowerCase()) > -1;
} }
}; };
$scope.onKeyPress = function ($event,query) {
console.log($event);
};
$scope.doToggle = function($event,el) { $scope.doToggle = function($event,el) {
this.isCollapsed = !el; this.isCollapsed = !el;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment