hello there i got a problem with pagination with sublist.. right know i can load the first 50 data from data..but when i click "2" link to load other page its doesnt load anything i notice that my code is use from and to and it will load only from and to..but how to increment from and to???can anyone give me some example..
here is the example
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
in my 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);
}
});
}
in load 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>