u011218582
米大人
2015-11-24 09:46
采纳率: 100%
浏览 4.6k
已采纳

easyUI datagrid刷新行之后行号会改变?

使用$('#tt').datagrid('refreshRow',index);去刷新某一行,刷新之后前面的行号发生改变,怎么解决?
图片说明
图片说明

 <!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Basic 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="../../jquery.easyui.min.js"></script>
</head>
<body>
    <h2>Basic DataGrid</h2>
    <p>The DataGrid is created from markup, no JavaScript code needed.</p>
    <div style="margin:20px 0;"></div>

    <table id="tt"> </table>
<script type="text/javascript">
$('#tt').datagrid({
        rownumbers:true,
        url: 'datagrid_data1.json',
        columns:[[
            {field:'itemid',title:'Item ID',align:'center',width:80},
            {field:'productid',title:'Product',align:'center',width:100},
            {field:'listprice',title:'List Price',align:'center',width:70},
            {field:'unitcost',title:'Unit Cost',align:'center',width:70},
            {field:'attr1',title:'Attribute',align:'center',width:250},
            {field:'status',title:'Status',align:'center',width:60},
            {field:'test',title:'test',align:'center',width:60,formatter:function(value,row,index){
                return  "&nbsp;&nbsp;<a href='javascript:void(0);' onClick=\"changeStatus('"+index+"')\">run</a>";
            }},
        ]]
    });
        function changeStatus(index){           
                $('#tt').datagrid('refreshRow',
                        index);
        }
    </script>
</body>
</html>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • showbo
    已采纳

    图片说明

    没问题啊。。什么版本的easyUI。。

    点赞 评论

相关推荐