jQuery EasyUI 互动版

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

添加复选框

通过复选框,用户将可以选择 选中/取消选中 网格行数据。为了添加一个复选框列,我们仅仅需要添加一个列的 checkbox 属性,并设置它为 true。

代码如下所示:

<table class="easyui-datagrid" title="Basic DataGrid" style="width:600px;height:250px"
            data-options="singleSelect:true,collapsible:true" id='dg'>
        <thead>
            <tr>
                <th field="ck" checkbox="true"></th>
                <th data-options="field:'itemid',width:80">Item ID</th>
                <th data-options="field:'productid',width:100">Product</th>
                <th data-options="field:'listprice',width:80,align:'right'">List Price</th>
                <th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
                <th data-options="field:'attr1',width:100">Attribute</th>
                <th data-options="field:'status',width:60,align:'center'">Status</th>
            </tr>
        </thead>
    </table>
按照上面代码,去练一练吧!