开发者社区> 问答> 正文

求助easyui中datagrid操作栏格式化变为按钮后数据显示错位问题

在使用easyui的过程中,通过使用onLoadSuccess将操作栏格式化成按钮之后,就会出现表格中数据错位的问题;将onLoadSuccess注释掉后,恢复正常。
不知道这里面是有什么问题,下面附上界面截图和datagrid的代码,希望大牛们帮忙看看~~感激不尽啊!!
screenshot
screenshot

 $(function(){
        $('#dg').datagrid({
            title:"学员信息",
            url:'system/studentinfo/data_getalllist',
            toolbar:'#toolbar',
            rownumbers:true, 
            pagination:true,
            collapsible:true, 
            //singleSelect:true,
            striped:true, 
            fitColumns:true,
            fit:true,
            nowrap:false,
            loadMsg:"正在加载数据,请稍等", 
            frozenColumns:[[
                {field:'student_ID',title:'编号',width:50,align:'center',checkbox:true},
                {field:'student_NUM',title:'学号',width:80,align:'center',sortable:true},
                {field:'student_NAME',title:'姓名',width:80,align:'center'}
            ]],
            columns:[[
                {field:'student_SEX',title:'性别',width:50,align:'center',rowspan:2},
                {field:'rank_NAME',title:'级别',width:80,align:'center',rowspan:2},
                {field:'student_IS_PAYTUITION',title:'是否已交学费',width:80,align:'center',rowspan:2,
                    formatter:function(value, record){
                        if (value == "N") {
                            value = "未交费";
                            return '<span style="color:red;">' + value + '</span>';
                        } else {
                            value = "已交费";
                            return value;
                        }
                    }
                },
                {field:'tuition_info',title:'学费信息',align:'center',colspan:3},
                {field:'student_STARTTIME',title:'注册时间',width:80,align:'center',rowspan:2},
                {field:'student_IS_ONSTUDY',title:'是否在学',width:80,align:'center',rowspan:2,
                    formatter:function(value, record){
                        if (value == "Y") {
                            value = "是";
                            return value;
                        } else {
                            value = "否";
                            return '<span style="color:red;">' + value + '</span>';
                        }
                    }
                },
                {field:'showdetail',title:'详细',width:100,align:'center',rowspan:2,
                    formatter:function(value, row, index){
                        var btn1 = '<a class="detailcls" href="javascript:void(0)" onclick="showdetail('+index+')" ></a>';
                        return btn1;
                    }
                },
                {field:'opr',title:'操作',width:100,align:'center',rowspan:2,
                    formatter:function(value, row, index){
                        var btn2 = '<a class="editcls" href="javascript:void(0)" onclick="editStudent('+index+')" ></a>';
                        return btn2;
                    }
                }],
                [{field:'tuition_TYPE',title:'学费类别',width:80,align:'center'},
                 {field:'student_TUITION_STARTTIME',title:'交费时间',width:80,align:'center'},
                 {field:'student_TUITION_ENDTIME',title:'到期时间',width:80,align:'center'}
            ]],
            onLoadSuccess:function(data){
                $('.detailcls').linkbutton({text:'详细信息',plain:true,iconCls:'icon-edit'});
                $('.editcls').linkbutton({text:'编辑',plain:true,iconCls:'icon-edit'});
            }
        })
    });

展开
收起
吴孟桥 2016-05-31 16:58:16 5117 0
1 条回答
写回答
取消 提交回答
  • onLoadSuccess里最后加上

     $('#dg').datagrid('fixRowHeight');
    2019-07-17 19:22:13
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载