1
0
Fork 0

Client: reset pagination when we search something

This commit is contained in:
Chocobozzz 2016-08-15 19:05:52 +02:00
parent 28f7d2020f
commit 7eef95353f
2 changed files with 9 additions and 3 deletions

View file

@ -66,6 +66,8 @@ export class VideoListComponent implements OnInit, OnDestroy {
// Subscribe to search changes
this.subSearch = this.searchService.searchUpdated.subscribe(search => {
this.search = search;
// Reset pagination
this.pagination.currentPage = 1;
this.navigateToNewParams();
});
@ -76,7 +78,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
this.subSearch.unsubscribe();
}
getVideos(detectChanges = true) {
getVideos() {
this.loading.next(true);
this.videos = [];
@ -153,7 +155,11 @@ export class VideoListComponent implements OnInit, OnDestroy {
this.sort = <SortField>routeParams['sort'] || '-createdDate';
this.pagination.currentPage = parseInt(routeParams['page']) || 1;
if (routeParams['page'] !== undefined) {
this.pagination.currentPage = parseInt(routeParams['page']);
} else {
this.pagination.currentPage = 1;
}
this.changeDetector.detectChanges();
}

View file

@ -35,12 +35,12 @@
"src/app/admin/admin.routes.ts",
"src/app/admin/friends/friend-list/friend-list.component.ts",
"src/app/admin/friends/friend-list/index.ts",
"src/app/admin/friends/friends.component.ts",
"src/app/admin/friends/friends.routes.ts",
"src/app/admin/friends/index.ts",
"src/app/admin/friends/shared/friend.model.ts",
"src/app/admin/friends/shared/friend.service.ts",
"src/app/admin/friends/shared/index.ts",
"src/app/admin/friends/users.component.ts",
"src/app/admin/index.ts",
"src/app/admin/menu-admin.component.ts",
"src/app/admin/users/index.ts",