EasyUI datagrid单元格文本超出显示省略号,鼠标移动到单元格显示文本

nowrap : true;  是前提

$('#×××').datagrid({
    nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取        
});

省略号样式:


<style type="text/css"> .datagrid-cell, .datagrid-cell-group, .datagrid-header-rownumber, .datagrid-cell-rownumber { text-overflow: ellipsis; } </style>

鼠标移动到单元格显示文本

<th data-options="field:'×××',70,align:'center',formatter:show1">×××</th>

代码1:

function show1(val,row){
    if (val){
        return '<span style="font-size:15px" title="' + val + '">' + val + '</span>';
    } else {
        return val;
    }
}

代码2:

function show2(value, row, index){
    var content = '';
    if(value != undefined && value != '' && value != null ){ 
        var abValue = value +'';
        content = '<a style="font-size:15px" href="javascript:void(0);"  title="' + abValue + '" class="easyui-tooltip">' + abValue + '</a>'; 
    }   
    return content;
}
原文地址:https://www.cnblogs.com/raitorei/p/9878192.html