Add: player list manager
This commit is contained in:
@@ -4,48 +4,52 @@
|
||||
let self = this;
|
||||
this.pageNoArea = pageNoArea;
|
||||
// console.log(parent);
|
||||
|
||||
this.activePageNo = 1;
|
||||
this.lastPageNo = 1;
|
||||
}
|
||||
|
||||
addPlayerListPages(playerCount) {
|
||||
lastPageNo = Math.ceil( (playerCount + 1) / 10 );
|
||||
updateNavigator(playerCount) {
|
||||
this.lastPageNo = Math.ceil( (playerCount + 1) / 10 );
|
||||
|
||||
$(this.pageNoArea).empty();
|
||||
|
||||
for(let pageNo = 1; pageNo < lastPageNo + 1; pageNo++) {
|
||||
for(let pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) {
|
||||
$(this.pageNoArea).append(
|
||||
"<a onClick='onClickPlayerListPage(" + pageNo + ")'> " + pageNo + " </a>"
|
||||
"<a onClick='onClickPlayerListPage(this, " + pageNo + ")'> " + pageNo + " </a>"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
onClickPlayerListPage(pageNo) {
|
||||
switch(pageNo) {
|
||||
case "first":
|
||||
this.activePageNo = 1;
|
||||
this.playerList.loadPlayerListPage(this.activePageNo);
|
||||
return;
|
||||
|
||||
case "prev":
|
||||
if(this.activePageNo > 1)
|
||||
this.activePageNo -= 1;
|
||||
this.playerList.loadPlayerListPage(this.activePageNo);
|
||||
return;
|
||||
|
||||
case "next":
|
||||
if(this.activePageNo < this.lastPageNo)
|
||||
this.activePageNo += 1;
|
||||
this.playerList.loadPlayerListPage(this.activePageNo);
|
||||
return;
|
||||
|
||||
function onClickPlayerListPage(pageNo) {
|
||||
switch(pageNo) {
|
||||
case "first":
|
||||
playerListPage = 1;
|
||||
loadPlayerListPage(playerListPage);
|
||||
return;
|
||||
case "last":
|
||||
this.playerList.loadPlayerListPage(this.lastPageNo);
|
||||
return;
|
||||
}
|
||||
|
||||
case "prev":
|
||||
if(playerListPage > 1)
|
||||
playerListPage -= 1;
|
||||
loadPlayerListPage(playerListPage);
|
||||
return;
|
||||
|
||||
case "next":
|
||||
if(playerListPage < lastPageNo)
|
||||
playerListPage += 1;
|
||||
loadPlayerListPage(playerListPage);
|
||||
return;
|
||||
|
||||
case "last":
|
||||
loadPlayerListPage(lastPageNo);
|
||||
return;
|
||||
this.activePageNo = pageNo;
|
||||
this.playerList.loadPlayerListPage(this.activePageNo);
|
||||
}
|
||||
|
||||
loadPlayerListPage(pageNo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user