EasyUI之datagrid的复选框使用

复选框是什么:放置一个复选框列到数据网格(DataGrid),用户将可以选择 选中/取消选中 网格行数据。


如何放置一个复选框:为了添加一个复选框列,只需添加一个列的 checkbox 属性,并设置它为 true。代码如下所示:

    	<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>

以上代码添加了一个带有 checkbox 属性的列,所以它将成为复选框列。如果 idField 属性已设置,数据网格(DataGrid)的选择集合将在不同的页面保持。

datagrid有两种属性用来操作复选框:

名称类型描述默认值
checkOnSelectboolean如果设置为 true,当用户点击某一行时,则会选中/取消选中复选框。如果设置为 false 时,只有当用户点击了复选框时,才会选中/取消选中复选框。该属性自版本 1.3 起可用。true
selectOnCheckboolean如果设置为 true,点击复选框将会选中该行。如果设置为 false,选中该行将不会选中复选框。
该属性自版本 1.3 起可用。
true 
  
   
  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值