pagination calculated based on xml only

This commit is contained in:
annampak 2017-11-06 12:17:05 +02:00
parent cc4bbabfba
commit ac1efd90b2
1 changed files with 6 additions and 1 deletions

View File

@ -1,8 +1,13 @@
export class PaginationService { export class PaginationService {
getPagination(groups, totalGroups: number, currentPage: number = 1, pageSize: number = 3) { getPagination(groups, totalGroups: number, currentPage: number = 1, pageSize: number = 3) {
// calculate total pages // calculate total pages
let totalPages = Math.ceil(totalGroups / pageSize); //let totalPages = Math.ceil(totalGroups / pageSize);
let totalPages = 0 ; //totalpages based on pages from xml, each group and section has each one page
groups.forEach(group => {
if (group.page > totalPages)
totalPages = parseInt(group.page);
});
let startPage: number, endPage: number; let startPage: number, endPage: number;
if (totalPages <= 10) { if (totalPages <= 10) {