ibator mysql 分页,ZUI分页器的使用案例(ECLIPSE SMS项目)
不足:并未編寫(xiě)導(dǎo)出功能
HTML代碼:
。。。
。。。
注釋:PAGE,指代頁(yè)碼;RECPERPAGE,指代每頁(yè)多少項(xiàng)數(shù)據(jù);total_count,指代總共多少條數(shù)據(jù)
jQuery代碼:
1 //頁(yè)面加載進(jìn)行賦值
2 window.onload =function page_init(){3 $("#total_count").val("${total_count}");4 }5
6 //ZUI分頁(yè)器
7 $('#myPager').pager({8 menuDirection: "dropup",9 onPageChange: function(state, oldState) {10 //alert(state.page+"/"+oldState.page);11 //alert(state.recPerPage+"/"+oldState.recPerPage);12 //當(dāng)頁(yè)碼或者每頁(yè)項(xiàng)目數(shù)發(fā)生改變時(shí)
13 if (((state.page != oldState.page) || (oldState.recPerPage != state.recPerPage)) && oldState.page != void(0) && oldState.recPerPage != void(0)) {14 //給頁(yè)碼,每頁(yè)項(xiàng)數(shù)賦值
15 $("#PAGE").val(state.page);16 $("#RECPERPAGE").val(state.recPerPage);17 var myPager = $('#myPager').data('zui.pager');18 var page =parseInt(state.page);19 var recperpage =parseInt(state.recPerPage);20 //alert("//"+page+"///"+recperpage);
21 myPager.set(page, null, recperpage);22 console.log('頁(yè)碼從', oldState.page, '變更為', state.page);23 document.forms[0].submit();24 }25 },26 elementCreator: function(element, $pager, state) { //導(dǎo)出的方法(下方的方法可放于XX.js中,導(dǎo)出需要自己去實(shí)現(xiàn))
27 if (element === 'export_exel_button') {28 return $("");29 }30 return false;31 }32 });
JSCode
JAVA代碼:
1 //短信列表
2 @RequestMapping(value = "/SMSLogList.cwai")3 public String SMSLogXq(Model model,String time,String total_count,HttpServletRequest request) throwsIOException {4 //獲取參數(shù)
5 String PAGE = request.getParameter("PAGE");//頁(yè)碼
6 String RECPERPAGE = request.getParameter("RECPERPAGE");//每頁(yè)項(xiàng)目數(shù)7 //總數(shù)是從父頁(yè)面?zhèn)鬟f的參數(shù)
8 if(total_count == null || "".equals(total_count)) {9 total_count = request.getParameter("total_count");10 }11 //獲取當(dāng)前登陸用戶信息
12 HttpSession session=request.getSession();13 User loginuser=(User) session.getAttribute("LoginUser");14 BmUser user =userservice.selectByUserName(loginuser.getUsername());15 String userId =user.getUserid();16
17 //設(shè)置默認(rèn)值
18 if("".equals(PAGE) || PAGE == null){19 PAGE = "1";//顯示首頁(yè)
20 RECPERPAGE = "10";//每頁(yè)10項(xiàng)
21 }22
23 List dxmsgloglist = dxmessageservice.selectDxMessageLogAllByTimePager(userId,PAGE,RECPERPAGE);//根據(jù)用戶ID,頁(yè)碼,每頁(yè)項(xiàng)數(shù)目進(jìn)行查詢
24 model.addAttribute("dxmsgloglist", dxmsgloglist);25 model.addAttribute("total_count", total_count);26 model.addAttribute("PAGE", PAGE);27 model.addAttribute("RECPERPAGE", RECPERPAGE);28 return "/home/SMSLogList";29 }
Java Code
對(duì)于其他屬性的使用與說(shuō)明,可進(jìn)入
進(jìn)行查看,URL:http://zui.sexy/#javascript/pagerjs
總結(jié)
以上是生活随笔為你收集整理的ibator mysql 分页,ZUI分页器的使用案例(ECLIPSE SMS项目)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 数据库大作业总结
- 下一篇: 怎样为Windows7系统设置快速启动栏