tabletr=tabletr+"<tr><td><input type='checkbox' class='checkboxAll' value='"+obj.id+"'/></td><td>"+obj.deviceName+"</td>"+"<td>"+obj.deviceIP+"</td>"+"<td>"+obj.companyName+"</td>"+"<td>"+obj.deviceSN+"</td>"+"<td>"+obj.devicePN+"</td>"+"<td>"+obj.inTime+"</td>"+"<td>"+obj.warrantyTime+"</td>"+"</tr>";
});
$("#tablepos_tbody").html(tabletr);
pageCount = data.total;
if(pageIndex==-1){
pageIndex=0;
$("#Pagination").pagination(pageCount, {
callback: PageCallback,//PageCallback() 为翻页调用次函数。
prev_text:"« 上一页",
next_text:"下一页 »",
items_per_page:pageSize,
num_edge_entries: 2, //两侧首尾分页条目数
num_display_entries: 6,//连续分页主体部分分页条目数
current_page: pageIndex,//当前页索引
});
}
}
});
}
action:
代码如下 复制代码
privateintrowCount=0;
privateintpageNo=1;
privateintpageSize=10;
privateintpageCount=0;
privateString result;
publicintgetRowCount() {
returnrowCount;
}
publicvoidsetRowCount(introwCount) {
this.rowCount = rowCount;
}
publicintgetPageNo() {
returnpageNo;
}
publicvoidsetPageNo(intpageNo) {
this.pageNo = pageNo;
}
publicintgetPageSize() {
returnpageSize;
}
publicvoidsetPageSize(intpageSize) {
this.pageSize = pageSize;
}
publicintgetPageCount() {
returnpageCount;
}
publicvoidsetPageCount(intpageCount) {
this.pageCount = pageCount;
}
publicString getResult() {
returnresult;
}
publicvoidsetResult(String result) {
this.result = result;
}
publicString findEquipmentInfo(){
Page page =newPage();
page.setStart(pageSize*pageNo);
page.setLimit((pageNo+1)*pageSize);
page.setTotalCount(service.rowCount());
List list=service.allperson(pageNo, pageSize);
System.out.println(pageNo+" "+pageSize );
this.setJsonStr(listToGridJoson(page, list));
returnSUCCESS;
}
home:
代码如下 复制代码
introwCount=0;
publicintrowCount(){
String sql ="select count(*) from EQUIPMENT_INFO";
Query query = sessionFactory.getCurrentSession().createSQLQuery(sql.toString());
introwCount = Integer.parseInt(query.uniqueResult().toString());
returnrowCount;
}
publicList allperson(intpageNo,intpageSize){
System.out.println(pageNo);
List list=this.all(pageNo, pageSize);
returnlist;
}
publicList all(intpageNo,intpageSize){
String sql ="from EquipmentInfo ";
Query query = sessionFactory.getCurrentSession().createQuery(sql.toString());
query.setFirstResult(pageSize*pageNo);
query.setMaxResults(pageSize);
List list = query.list();
returnlist;
}
没有了