jquery.pagination.js分页使用教程

2022-01-14,,,,

这篇文章主要为大家详细介绍了jquery.pagination.js分页使用教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

简单介绍一下在动态网页里面的jquery.pagination.js分页的使用,具体内容如下

添加下载的js和样式,主要是先添加jquery.js 再添加jquery.pagination.js,我这是下载好的,放在本地

 <link rel="stylesheet" href="css/pagination.css" type="text/css">

表格,用的是c标签,获取控制器传过来的值

 
商品显示
商品编号商品大类商品名称商品规格加权进价当前售价操作

js

 var limit=;//每页显示多少 条数据 var count=//共多少条数据 var index=;//当前记录数 $(function(){ $("#Pagination").pagination(count, { items_per_page:limit, // 每页显示多少条记录 current_page: Math.ceil(index/limit), //当前页 num_display_entries:4, // 分页显示的条目数 next_text:"下一页", prev_text:"上一页", num_edge_entries:2, // 连接分页主体,显示的条目数 callback:handlePaginationClick }); }); function handlePaginationClick(new_page_index, pagination_container) { var path="/goodsManager/searchGoodsBylimit/" + new_page_index*limit; $("#goodsForm").attr("action",path ); $("#goodsForm").submit(); return false; } 

控制器

 @RequestMapping(value = "/searchGoodsBylimit/{index}") public String searchGoodsBylimitPst(Model model, @ModelAttribute Goods goods, @PathVariable String index, HttpServletRequest request) { //索引 if (index == null || index.equals("")) { index = "0"; //从服务器获取数据 List goodsS = goodsService.selectGoods(goods, Integer.parseInt(index), PageParam.limit); if (goodsS != null) { model.addAttribute("goodsS", goodsS); } else { model.addAttribute("resultMsg", "没有该商品"); } //数据总条数 int count = goodsService.selectAllCount(goods); model.addAttribute("index", index); model.addAttribute("count", count); model.addAttribute("limit", PageParam.limit); System.out.println("第" + index + "数据开始显示" + goodsS.size() + "条记录"); return "goodsManager/showGoods"; } 

效果图

以上就是jquery.pagination.js分页使用教程的详细内容,更多请关注本站其它相关文章!

《jquery.pagination.js分页使用教程.doc》

下载本文的Word格式文档,以方便收藏与打印。