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])
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM