Easy Tutorial
❮ Plugins Mb Menu Plugins Base Progressbar ❯

jQuery EasyUI DataGrid - Add Checkbox

This example demonstrates how to place a checkbox column in the DataGrid. With checkboxes, users can select or deselect rows in the grid.

To add a checkbox column, we simply need to add a column with the checkbox attribute set to true. The code is as follows:

<table id="tt" title="Checkbox Select" 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">Item ID</th>
                <th field="productid" width="80">Product ID</th>
                <th field="listprice" width="80" align="right">List Price</th>
                <th field="unitcost" width="80" align="right">Unit Cost</th>
                <th field="attr1" width="100">Attribute</th>
                <th field="status" width="60" align="center">Status</th>
            </tr>
        </thead>
    </table>

The above code adds a column with the checkbox attribute, making it a checkbox column. If the idField attribute is set, the DataGrid's selection will be maintained across different pages.

Download jQuery EasyUI Example

jeasyui-datagrid-datagrid10.zip

❮ Plugins Mb Menu Plugins Base Progressbar ❯