解决方案 »

  1.   

    1.3.1+以上版本easyui测试没有出现你这个问题什么版本的easyui
      

  2.   

    不是版本的问题
    我用的是[jQuery EasyUI 1.3.5]
      

  3.   


    你的是取官网下的没?我这里那easyui的datagrid\checkbox.html这个示例来测试没发现你说的问题
      

  4.   


    你的是取官网下的没?我这里那easyui的datagrid\checkbox.html这个示例来测试没发现你说的问题你可能没理解我的意思,我是不理解测试1为什么返回的Array长度为0,我用的js是这个<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>,要不你试试这个
      

  5.   

    你可能没理解我的意思,我是不理解测试1为什么返回的Array长度为0,我用的js是这个<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>,要不你试试这个
      

  6.   

    各位知道不知道datagrid的acceptChanges方法在什么位置定义的这些文件里都没有找到,这是官方源码,我想读下源码
      

  7.   

    <!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>完全没有问题。。
      

  8.   

    请看
        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热心帮助
      

  9.   

    可编辑的执行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来代替