layui单元格换行 使其能显示,如果左右列固定,在done回调中使用下方方法
.layui-table-cell {
height: auto;
}
//固定行随单元格自动调整
function autoFixedHeight(tableElem) {
// 获取表格div
var $tableView = $(tableElem).next(".layui-table-view");
// 获取两侧浮动栏
var $fixed = $tableView.find(".layui-table-fixed");
var dataIndex;
var trHeight;
// 遍历tr 修正浮动栏行高
$tableView.find(".layui-table-main").find("tr").each(function () {
dataIndex = $(this).attr("data-index");
trHeight = $(this).css("height");
$fixed.find("tr[data-index=" + dataIndex + "]").css("height", trHeight);
});
}
//使用
//layui.....
done:function(){
autoFixedHeight(this.elem[0])
}