소장자료 페이징처리 수정

This commit is contained in:
JSYOO 2021-10-08 14:20:50 +09:00
parent c49b27ff5d
commit 8eb4300776
3 changed files with 44 additions and 17 deletions

View File

@ -12,7 +12,7 @@ public class PagingVO {
int endPage = 0; /* 끝페이지 */
int lastPage = 0; /* 마지막페이지 */
private int cntPage = 5; /* 노출되는 페이지 개수 ex) << < 1 2 3 4 5 > >> */
private int cntPage = DEFAULT_PAGE_SIZE; /* 노출되는 페이지 개수 ex) << < 1 2 3 4 5 > >> */
public int getStartPage() {
return startPage;
@ -128,8 +128,16 @@ public class PagingVO {
setEndPage(((int)Math.ceil((double)pageIndex / (double)cntPage )) * cntPage );
if (getLastPage() < getEndPage()) {
setEndPage(getLastPage());
}
if(getTotRecordCount() > 0)
{
if(getEndPage() % cntPage == 0)
{
setStartPage( 1 + (getEndPage() / cntPage - 1) * cntPage);
}else {
setStartPage(getEndPage() / cntPage * cntPage +1);
}
}
setStartPage(getEndPage() - cntPage + 1);
if (getStartPage() < 1) {
setStartPage(1);
}

File diff suppressed because one or more lines are too long

View File

@ -231,9 +231,9 @@ function paging(pageVO)
var html="";
var startPage = pageVO.startPage;
var endPage = pageVO.endPage;
if(pageVO.startPage != pageVO.lastPage )
if(pageVO.totalCount != 0)
{
if(pageVO.pageIndex != 1 ){
html+="<a href=\"#\" onclick=\"fn_search_article("+ 1 +"); return false;\">\<\<</a> "
html+="<a href=\"#\" onclick=\"fn_search_article("+ (pageVO.pageIndex*1 -1) +"); return false;\">\<</a> ";
@ -259,6 +259,8 @@ function paging(pageVO)
html+="<a>\></a> "
html+="<a>\>\></a>";
}
}else{
html+= "데이터가 없습니다.";
}