如何使用子列表进行分页

时间:2013-12-30 06:12:39

标签: java jquery jsp pagination

你好,我的子列表分页有问题.. 知道我可以从数据中加载前50个数据..但是当我点击“2”链接加载其他页面时它不会加载任何东西我注意到我的代码是使用from和to而它只会加载来自to..but如何从和增加???任何人都可以给我一些例子..

这是示例

int from= 0;
int to = 50;
List subList = logList.subList(from, to);

//pagination 
if (logList.size()>50){

setTotalSessionRecord(logList.size());
int sessionCountPages = (logList.size()/subList.size());
if ((logList.size() % subList.size()) > 0) {
    sessionCountPages++;
}
setTotalSessionPage(sessionCountPages);

if (getSessionPage() == 0) {
    setSessionPage(1);
} else if (getSessionPage() > getTotalSessionPage()) {
    setSessionPage(getTotalSessionPage());
}

int startPages = (getSessionPage() - 1) * logList.size();
startPages++;

arg = new ArgumentBuilder();
arg.addArg(getSessionLogId());
arg.addArg(startPages);
arg.addArg(logList.size());
arg.addArg(isAsCending());
//end of pagination

在我的jsp中

function toSessionPage(sessionPage, ascOrderSession , id, 
  folderId , numberOfSessions , selectedSessionPages) {     
    var tURL = '<%=request.getContextPath()%>/home/Folder.action?
       listSessionLogEvents=&sessionLogId=' + id + '&folderID=' + folderId  + 
       '&sessionPage=' + sessionPage + '&numberOfSessionPages='+ numberOfSessions 
       + '&selectedSessionPages=' + selectedSessionPages 
       + '&asCending=' + ascOrderSession ;
    jQuery.ajax({
    url: tURL,
    dataType: 'html',
    success: function(returnData) {
        jQuery('#detailTR' + id).html(returnData);
    }
});
}

function toSelectedSessionPages(sessionPage, selectedSessionPages, 
             ascOrderSession,id ,folderId) {        
   var tURL = '<%=request.getContextPath()%>/home/Folder.action?
       listSessionLogEvents=&sessionLogId=' + id + '&folderID=' + "11" 
       + '&sessionPage=' + sessionPage + '&selectedSessionPages=' 
       + selectedSessionPages +'&asCending=' + ascOrderSession ;
    jQuery.ajax({
    url: tURL,
    dataType: 'html',
    success: function(returnData) {
        jQuery('#detailTR' + id).html(returnData);
    }
});
}

在加载jsp ..

<td align="center" width = "60%" >                          
Page:                         
<% 
   int toSessionPage = 0;                                   
    if(fa.getTotalSessionPage() - fa.getNumberOfSessionPages() > 20){
      toSessionPage = fa.getNumberOfSessionPages() + 19;                                        
    }else{
      toSessionPage = fa.getTotalSessionPage();
    }                                   
    int i = 0;
    for ( i= fa.getSelectedSessionPages(); i <= toSessionPage; i++) { 
        if (fa.getSessionPage() == i) {%>
        <font class="selectedPage"><%=i%></font>
    <%  } else { %>
        <a href="javascript:toSelectedSessionPages(<%=i%>,${actionBean.selectedSessionPages},
     '${actionBean.asCending}', '${actionBean.sessionLogId}')">
     <font class="unselectedPage"><%=i%></font></a>
    <% }
    if(i != toSessionPage) { %><font class="unselectedPage">|</font><% }
      } fa.setNumberOfSessionPages(i); %>
  </td>

0 个答案:

没有答案