Skip to content

Commit 71f8d13

Browse files
Updated pagination next/previous detection. Resolves #1063. (#1158)
1 parent f16a4ce commit 71f8d13

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

spa/src/app/files/hca-table-pagination/hca-table-pagination.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,25 @@ export class HCATablePaginationComponent implements OnInit {
112112
}
113113

114114
/**
115-
* Check if there is a next page.
115+
* Check if there is a next page. Use search_after_uid and not search_after as null is a valid value for
116+
* search_after.
116117
*
117118
* @param {PaginationModel} pm
118119
* @returns {boolean}
119120
*/
120121
public hasNext(pm: PaginationModel): boolean {
121-
// return (pm.from + pm.count) < pm.total;
122-
return pm.search_after !== null;
122+
return pm.search_after_uid !== null;
123123
}
124124

125125
/**
126-
* Check if there is a previous page.
126+
* Check if there is a previous page. Use search_before_uid and not search_before as null is a valid value for
127+
* search_before.
127128
*
128129
* @param {PaginationModel} pm
129130
* @returns {boolean}
130131
*/
131132
public hasPrevious(pm: PaginationModel): boolean {
132-
// return (pm.from > 1);
133-
return pm.search_before !== null;
133+
return pm.search_before_uid !== null;
134134
}
135135

136136
/**

spa/src/app/files/shared/files.service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,15 @@ export class FilesService {
355355
paramMap["order"] = tableParams.order;
356356
}
357357

358-
// check if there is paging
359-
if ( tableParams.search_after && tableParams.search_after_uid ) {
358+
// check if there is paging - use search_after_uid and not search_after as null is a valid value for search_after
359+
if ( tableParams.search_after_uid ) {
360360

361361
paramMap["search_after"] = tableParams.search_after;
362362
paramMap["search_after_uid"] = tableParams.search_after_uid;
363363
}
364364

365-
if ( tableParams.search_before && tableParams.search_before_uid ) {
365+
// Use search_before_uid and not search_before as null is a valid value for search_before
366+
if ( tableParams.search_before_uid ) {
366367

367368
paramMap["search_before"] = tableParams.search_before;
368369
paramMap["search_before_uid"] = tableParams.search_before_uid;

0 commit comments

Comments
 (0)