diff --git a/src/app/search-page/search-page.component.ts b/src/app/search-page/search-page.component.ts index eec01d0a0c..a35f6f01a3 100644 --- a/src/app/search-page/search-page.component.ts +++ b/src/app/search-page/search-page.component.ts @@ -27,7 +27,6 @@ export class SearchPageComponent implements OnInit, OnDestroy { query: string; private scope: string; scopeObject: RemoteData; - private page: number; results: RemoteData>>; currentParams = {}; searchOptions: SearchOptions; @@ -56,7 +55,7 @@ export class SearchPageComponent implements OnInit, OnDestroy { this.scope = params.scope; const page = +params.page || this.searchOptions.pagination.currentPage; const pageSize = +params.pageSize || this.searchOptions.pagination.pageSize; - const sortDirection = +params.page || this.searchOptions.sort.direction; + const sortDirection = +params.sortDirection || this.searchOptions.sort.direction; const pagination = Object.assign({}, this.searchOptions.pagination, { currentPage: page, pageSize: pageSize } diff --git a/src/app/search-page/search-page.module.ts b/src/app/search-page/search-page.module.ts index 8cb5f3d886..67a88f579c 100644 --- a/src/app/search-page/search-page.module.ts +++ b/src/app/search-page/search-page.module.ts @@ -7,7 +7,6 @@ import { TranslateModule } from '@ngx-translate/core'; import { SharedModule } from '../shared/shared.module'; import { SearchPageRoutingModule } from './search-page-routing.module'; import { SearchPageComponent } from './search-page.component'; -import { SearchFormComponent } from '../shared/search-form/search-form.component'; import { SearchResultsComponent } from './search-results/search-results.compontent'; import { SearchModule } from '../search/search.module'; import { ItemSearchResultListElementComponent } from '../object-list/search-result-list-element/item-search-result/item-search-result-list-element.component'; diff --git a/src/app/shared/pagination/pagination.component.html b/src/app/shared/pagination/pagination.component.html index 4c8dec81bd..91a6c07929 100644 --- a/src/app/shared/pagination/pagination.component.html +++ b/src/app/shared/pagination/pagination.component.html @@ -10,13 +10,12 @@ - diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index 8ed27e4729..f163dc5975 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -35,7 +35,6 @@ import { PageInfo } from '../../core/shared/page-info.model'; encapsulation: ViewEncapsulation.Emulated }) export class PaginationComponent implements OnDestroy, OnInit { - /** * Number of items in collection. */ @@ -185,7 +184,7 @@ export class PaginationComponent implements OnDestroy, OnInit { // Listen to changes this.subs.push(this.route.queryParams .subscribe((queryParams) => { - if (isEmpty(queryParams)) { + if (this.isEmptyPaginationParams(queryParams)) { this.initializeConfig(); } else { this.currentQueryParams = queryParams; @@ -470,7 +469,22 @@ export class PaginationComponent implements OnDestroy, OnInit { } /** - * Method to check whether the current pagination object has multiple pages + * Method to check if none of the query params necessary for pagination are filled out. + * + * @param paginateOptions + * The paginate options object. + */ + private isEmptyPaginationParams(paginateOptions): boolean { + const properties = ['id', 'currentPage', 'pageSize', 'pageSizeOptions']; + const missing = properties.filter((prop) => { + return !(prop in paginateOptions); + }); + + return properties.length === missing.length; + } + + /** + * Property to check whether the current pagination object has multiple pages * @returns true if there are multiple pages, else returns false */ get hasMultiplePages(): boolean { @@ -478,7 +492,7 @@ export class PaginationComponent implements OnDestroy, OnInit { } /** - * Method to check whether the current pagination should show a bottom pages + * Property to check whether the current pagination should show a bottom pages * @returns true if a bottom pages should be shown, else returns false */ get shouldShowBottomPager(): boolean { diff --git a/src/app/shared/search-form/search-form.component.ts b/src/app/shared/search-form/search-form.component.ts index fa019e61d1..1c80356298 100644 --- a/src/app/shared/search-form/search-form.component.ts +++ b/src/app/shared/search-form/search-form.component.ts @@ -56,8 +56,7 @@ export class SearchFormComponent implements OnInit, OnDestroy { queryParams: Object.assign({}, this.currentParams, { query: data.query, - scope: data.scope || undefined, - page: data.page || 1 + scope: data.scope || undefined } ) })