教程 »在DataGrid上选择CheckBox
本教程将向您介绍如何在DataGrid上放置复选框列。通过复选框,用户可以选择一次选择/取消选择网格行。
观看演示要添加复选框列,我们只需添加一个带有复选框属性的列并将其设置为true。代码看起来像这样:
<table id = “tt” title = “复选框选择” class = “easyui-datagrid” style = “ width :550px ; height :250px ” url = “data / datagrid_data.json” idField = “itemid” pagination = “true” iconCls = “图标保存” > <THEAD> <TR> <th field = “ck” checkbox = “true” > </ th> <th field = “itemid” width = “80” > 商品ID </ th> <th field = “productid” width = “80” > 产品ID </ th> <th field = “listprice” width = “80” align = “right” > List Price </ th> <th field = “unitcost” width = “80” align = “right” > 单位成本</ th> <th field = “attr1” width = “100” > 属性</ th> <th field = “status” width = “60” align = “center” > Status </ th> </ TR> </ THEAD></ TABLE>上面的代码我们添加了一个具有复选框属性的列,因此它将成为复选框列。如果设置了idField属性,则DataGrid的选择将保留在不同的页面中。
