yanxin9210 2015-05-11 08:50 采纳率: 71.4%
浏览 4495
已采纳

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

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

如图所示,红框部分错位了
图片说明

 $(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'});
            }
        })
    });
  • 写回答

1条回答

  • 逝_去_的_光_阴 2015-05-11 09:18
    关注

    onLoadSuccess里最后加上

     $('#dg').datagrid('fixRowHeight');
    

    试试有没有效果

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算