CheckBox select on DataGrid
Tutorial » Selecting CheckBox on DataGrid
This tutorial will show you how to place a checkbox column on a DataGrid. With checkboxes, the user has the option to select/deselect grid rows once.
To add a checkbox column, we just add a column with a checkbox attribute and set it to true. The code looks like this:
- <table id = "tt" title = "checkbox selection" class = "easyui-datagrid" style = " width : 550px ; height : 250px "
- url = “data / datagrid_data.json”
- idField = “itemid” pagination = “true”
- iconCls = "icon save" >
- <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" > unitcost </th>
- <th field = “attr1” width = “100” > 属性</ th>
- <th field = “status” width = “60” align = “center” > Status </ th>
- </ TR>
- </ THEAD>
- </ TABLE>
Above code we add a column with checkbox property so it will be checkbox column. If the idField property is set, the selection of the DataGrid will remain in different pages.