CheckBox在DataGrid上选择复选框

CheckBox在DataGrid上选择

教程 »在DataGrid上选择CheckBox

本教程将向您介绍如何在DataGrid上放置复选框列。通过复选框,用户可以选择一次选择/取消选择网格行。

要添加复选框列,我们只需添加一个带有复选框属性的列并将其设置为true。代码看起来像这样:

 
 
  1. <table id = “tt” title = “复选框选择” class = “easyui-datagrid” style = width 550px ; height 250px
  2. url = “data / datagrid_data.json”
  3. idField = “itemid” pagination = “true”
  4. iconCls = “图标保存” >
  5. <THEAD>
  6. <TR>
  7. <th field = “ck” checkbox = “true” > </ th>
  8. <th field = “itemid” width = “80” > 商品ID </ th>
  9. <th field = “productid” width = “80” > 产品ID </ th>
  10. <th field = “listprice” width = “80” align = “right” > List Price </ th>
  11. <th field = “unitcost” width = “80” align = “right” > 单位成本</ th>
  12. <th field = “attr1” width = “100” > 属性</ th>
  13. <th field = “status” width = “60” align = “center” > Status </ th>
  14. </ TR>
  15. </ THEAD>
  16. </ TABLE>

上面的代码我们添加了一个具有复选框属性的列,因此它将成为复选框列。如果设置了idField属性,则DataGrid的选择将保留在不同的页面中。

下载EasyUI示例:

猜你喜欢

转载自blog.csdn.net/qq_40435659/article/details/79869971
今日推荐