jQuery EasyUI datagrid在翻页以后仍能记录被选中行的(2)

@RequestMapping("/getGoodsOnSale") @ResponseBody public GridModel getGoodsOnSale(HttpServletRequest request, @RequestParam("page") Integer page, @RequestParam("rows") Integer rows) { Integer userRight = (Integer)(LoginController.getFromSession(request, ConstantsUtil.SESSION_USER_RIGHT)); List<Goods> goods = new ArrayList<Goods>(); Long total = new Long(); if(userRight.equals(ConstantsUtil.USER_RIGHTS_ADMIN)){ goods = goodsService.getGoodsOnSale(page, rows); total = goodsService.getGoodsOnSaleCount(); }else{ List<Brand> brands = (List<Brand>)(LoginController.getFromSession(request, ConstantsUtil.SESSION_USER_BRANDS)); goods = goodsService.getGoodsOnSale(brands,page, rows); total = goodsService.getGoodsOnSaleCount(brands); } GridModel gridModel = getGoods(goods, request); gridModel.setTotal(total); return gridModel; }

说明:后台从request.getParameter里取两个参数,page和rows,分别代表当前的页数及每页显示几行数据。total是总数据数。

GridModel类:

public class GridModel { private List rows= new ArrayList(); private Long total=0L; public List getRows() { return rows; } public void setRows(List rows) { this.rows = rows; } public Long getTotal() { return total; } public void setTotal(Long total) { this.total = total; } }

问题2:如何在datagrid表格里第一列显示checkbox,并且让行选中和checkbox选中等同?

答:

1、singleSelect:false,设置表格为复选模式

2、{field:'ck',checkbox:true},这里面的checkbox:true表示该列显示复选按钮。

2、查看easyUI的文档:可以得知两个属性——checkOnSelect和selectOnCheck。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzxwyd.html