yanxin9210
yanxin9210
采纳率71.4%
2015-05-11 08:50 阅读 4.5k

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条回答 默认 最新

  • 已采纳
    u011376884 逝_去_的_光_阴 2015-05-11 09:18

    onLoadSuccess里最后加上

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

    试试有没有效果

    点赞 3 评论 复制链接分享

相关推荐