jQuery easyui datagrid中调用了acceptChanges后getChecked方法取值为空 easyuidatagridjquery 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1.3.1+以上版本easyui测试没有出现你这个问题什么版本的easyui 不是版本的问题我用的是[jQuery EasyUI 1.3.5] 你的是取官网下的没?我这里那easyui的datagrid\checkbox.html这个示例来测试没发现你说的问题 你的是取官网下的没?我这里那easyui的datagrid\checkbox.html这个示例来测试没发现你说的问题你可能没理解我的意思,我是不理解测试1为什么返回的Array长度为0,我用的js是这个<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>,要不你试试这个 你可能没理解我的意思,我是不理解测试1为什么返回的Array长度为0,我用的js是这个<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>,要不你试试这个 各位知道不知道datagrid的acceptChanges方法在什么位置定义的这些文件里都没有找到,这是官方源码,我想读下源码 <!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>CheckBox Selection on DataGrid - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../../themes/icon.css"> <link rel="stylesheet" type="text/css" href="../demo.css"> <script type="text/javascript" src="../../jquery.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script></head><body> <h2>CheckBox Selection on DataGrid</h2> <div class="demo-info"> <div class="demo-tip icon-tip"></div> <div>Click the checkbox on header to select or unselect all selections.</div> </div> <div style="margin:10px 0;"></div> <table id="dg" class="easyui-datagrid" title="CheckBox Selection on DataGrid" style="width:700px;height:250px" data-options="rownumbers:true,url:'datagrid_data1.json',method:'get'"> <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> <input type="button" value="DIRChecked" onclick='jQuery("#dg").datagrid("acceptChanges"); console.dir(jQuery("#dg").datagrid("getChecked"));' /></body></html>完全没有问题。。 请看 onLoadSuccess: function() { for (var i = 0; i < jQuery("#repoInDetailGrid").datagrid("getRows").length; i++) { jQuery("#repoInDetailGrid").datagrid("beginEdit", i); } }这段代码,还执行了beginEdit方法,表格的column有的配置了editor重新理一下思路: 数据加载完成后会进入编辑状态(重点前提),这时候,选中checkbox,然后执行acceptChanges方法,然后再打印getChecked方法返回的数据,结果为Array[0],一定会出现这种情况的感谢:版主showbo热心帮助 可编辑的执行jQuery("#dg").datagrid("acceptChanges");后获取getChecked确实得不到勾选的数据。。看了下源代码,应该是easyui的bug,因为可编辑的执行acceptChanges方法后将勾选数据行的datagrid-row-checked给去掉了。。但是easyui获取勾选的数据行是通过tr是否有datagrid-row-checked这个样式来判断的。。if(type=="checked"){return (_70e==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-checked");}改用getSelections来代替 JavaScript问题 帮我改成3D浮动效果 disabled属性的怪问题 函数的返回值问题! 请教一个javascript保存用户输入的问题 关于setInterval的问题 请教如何实现LOADING 救急!!怎样在循环里面使用层? 菜鸟问题,分数不低 请教一个关闭按钮执行的问题,很简单,会者举手之劳 求个简单正则 郁闷到不行,竟然拿不到getElementById();
我用的是[jQuery EasyUI 1.3.5]
你的是取官网下的没?我这里那easyui的datagrid\checkbox.html这个示例来测试没发现你说的问题
你的是取官网下的没?我这里那easyui的datagrid\checkbox.html这个示例来测试没发现你说的问题你可能没理解我的意思,我是不理解测试1为什么返回的Array长度为0,我用的js是这个<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>,要不你试试这个
<html>
<head>
<meta charset="UTF-8">
<title>CheckBox Selection on DataGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<h2>CheckBox Selection on DataGrid</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>Click the checkbox on header to select or unselect all selections.</div>
</div>
<div style="margin:10px 0;"></div>
<table id="dg" class="easyui-datagrid" title="CheckBox Selection on DataGrid" style="width:700px;height:250px"
data-options="rownumbers:true,url:'datagrid_data1.json',method:'get'">
<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>
<input type="button" value="DIRChecked" onclick='jQuery("#dg").datagrid("acceptChanges"); console.dir(jQuery("#dg").datagrid("getChecked"));' /></body>
</html>完全没有问题。。
onLoadSuccess: function() {
for (var i = 0; i < jQuery("#repoInDetailGrid").datagrid("getRows").length; i++) {
jQuery("#repoInDetailGrid").datagrid("beginEdit", i);
}
}这段代码,还执行了beginEdit方法,表格的column有的配置了editor
重新理一下思路:
数据加载完成后会进入编辑状态(重点前提),这时候,选中checkbox,然后执行acceptChanges方法,然后再打印getChecked方法返回的数据,结果为Array[0],一定会出现这种情况的感谢:版主showbo热心帮助
return (_70e==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-checked");
}改用getSelections来代替