ibator mysql 分页,ZUI分页器的使用案例(ECLIPSE SMS项目)
不足:并未編寫導出功能
HTML代碼:
。。。
。。。
注釋:PAGE,指代頁碼;RECPERPAGE,指代每頁多少項數據;total_count,指代總共多少條數據
jQuery代碼:
1 //頁面加載進行賦值
2 window.onload =function page_init(){3 $("#total_count").val("${total_count}");4 }5
6 //ZUI分頁器
7 $('#myPager').pager({8 menuDirection: "dropup",9 onPageChange: function(state, oldState) {10 //alert(state.page+"/"+oldState.page);11 //alert(state.recPerPage+"/"+oldState.recPerPage);12 //當頁碼或者每頁項目數發生改變時
13 if (((state.page != oldState.page) || (oldState.recPerPage != state.recPerPage)) && oldState.page != void(0) && oldState.recPerPage != void(0)) {14 //給頁碼,每頁項數賦值
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('頁碼從', oldState.page, '變更為', state.page);23 document.forms[0].submit();24 }25 },26 elementCreator: function(element, $pager, state) { //導出的方法(下方的方法可放于XX.js中,導出需要自己去實現)
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 //獲取參數
5 String PAGE = request.getParameter("PAGE");//頁碼
6 String RECPERPAGE = request.getParameter("RECPERPAGE");//每頁項目數7 //總數是從父頁面傳遞的參數
8 if(total_count == null || "".equals(total_count)) {9 total_count = request.getParameter("total_count");10 }11 //獲取當前登陸用戶信息
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 //設置默認值
18 if("".equals(PAGE) || PAGE == null){19 PAGE = "1";//顯示首頁
20 RECPERPAGE = "10";//每頁10項
21 }22
23 List dxmsgloglist = dxmessageservice.selectDxMessageLogAllByTimePager(userId,PAGE,RECPERPAGE);//根據用戶ID,頁碼,每頁項數目進行查詢
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
對于其他屬性的使用與說明,可進入
進行查看,URL:http://zui.sexy/#javascript/pagerjs
總結
以上是生活随笔為你收集整理的ibator mysql 分页,ZUI分页器的使用案例(ECLIPSE SMS项目)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据库大作业总结
- 下一篇: 连接数据库的Provider、Drive