<div id="myDatagrid"">
<table id="datagridID" class="easyui-datagrid"
data-options="pagination:true,rownumbers:true,
fitColumns:true,url:'...',loadMsg:'load data...'">
<thead>
<tr>
<th data-options="field:'checkBox',checkbox:true"></th>
</tr>
</thead>
</table>
</div> 代码如上所示,我想让checkbox初始化就为全部选中,不知道应该怎么做?
谢谢CheckBoxeasy-uidata-options
<table id="datagridID" class="easyui-datagrid"
data-options="pagination:true,rownumbers:true,
fitColumns:true,url:'...',loadMsg:'load data...'">
<thead>
<tr>
<th data-options="field:'checkBox',checkbox:true"></th>
</tr>
</thead>
</table>
</div> 代码如上所示,我想让checkbox初始化就为全部选中,不知道应该怎么做?
谢谢CheckBoxeasy-uidata-options
$( function() {
$("input:checkbox").attr("checked",true);
}
);使用原生javascriptwindow.onload=function() {
var checks=document.getElementsByName("test");
var i,len=checks.length;
for(i=0;i<len;i++ ) {
checks[i].checked=true;
}
}
不过你说的这种方式只适用于一般的checkbox,我用的checkbox是用data-options申明,而且行数是根据datagrid中数据来定的