easyui datagrid 单元格数据超出后自动换行

EasyUI表格中数据超出自动换行设置

方案一: 使用 easyui 自带的nowrap 来设置table

$('#dg').datagrid({
    nowrap: false,
    columns:[[
        {field:'userId',title:'User', width:80,
            formatter: function(value,row,index){
                if (row.user){
                    return row.user.name;
                } else {
                    return value;
                }
            }
        }
    ]]
});

方案二: 可以使用 字符串中添加 br 标签进行换行展示

这种方式是在 特定列换行,特定信息位置换行

$('#dg').datagrid({
    nowrap: false,
    columns:[[
        {field:'userId',title:'User', width:80,
            formatter: function(value,row,index){
                return 'hello<br>world'
            }
        }
    ]]
});

猜你喜欢

转载自blog.csdn.net/palmer_kai/article/details/79638390