class MaestroListNavigator { constructor(pageNoArea) { let self = this; this.pageNoArea = pageNoArea; // console.log(parent); this.activePageNo = 1; this.lastPageNo = 1; } updateNavigator(activePageNo, lastPageNo) { this.activePageNo = activePageNo; this.lastPageNo = lastPageNo; // this.lastPageNo = Math.ceil( (maestroCount + 1) / 10 ); $(this.pageNoArea).empty(); for(let pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) { $(this.pageNoArea).append( " " + pageNo + " " ); } } onClickMaestroListPage(pageNo) { switch(pageNo) { case "first": this.activePageNo = 1; this.maestroList.loadMaestroListPage(this.activePageNo); return; case "prev": if(this.activePageNo > 1) this.activePageNo -= 1; this.maestroList.loadMaestroListPage(this.activePageNo); return; case "next": if(this.activePageNo < this.lastPageNo) this.activePageNo += 1; this.maestroList.loadMaestroListPage(this.activePageNo); return; case "last": this.maestroList.loadMaestroListPage(this.lastPageNo); return; } this.activePageNo = pageNo; this.maestroList.loadMaestroListPage(this.activePageNo); } }