代码如上所示,我想让checkbox初始化就为全部选中,不知道应该怎么做?
谢谢
[code="java"]
<!DOCTYPE html>
<table id="dg" class="easyui-datagrid" title="CheckBox Selection on DataGrid" style="width:700px;height:250px"
data-options="rownumbers:true,url:'../datagrid/datagrid_data1.json',onLoadSuccess:selectAllBox">
<thead>
<tr>
<th data-options="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:220">Attribute</th>
<th data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
[/code]
[code="java"]
{field:'ck',checkbox:true},
[/code]
这个换成下面的写法就行了。从后台取数据再确定是否选中,则判断value值即可。
[code="java"]
{field:'ck',formatter:function(value,rec){
return '';
}},
[/code]
这个好像没有属性的配置吧 不过自己用js去空间也相当的简单的