layui數據表格排序圖標被超出的表頭擠出去


如果表頭過長,會出現超出顯示三個省略號,然后把排序圖標擠出去,看不到了,
效果如下

解決辦法就是給圖標加定位,過長的時候加上

        .show-sort{
            position: absolute;
            right: 7px;
            top: 5px;
        }

     $('.layui-table-header tr th').each(function(i,ths){
         $(this).find('span:first').attr('title',$(this).find('span:first').text()); // 划過顯示
         if($(this).find('span:first').width() > $(this).find('.layui-table-cell').width()){
             $(this).find('span:last').addClass('show-sort')
         }else{
            $(this).find('span:last').removeClass('show-sort')
         }
     })

修改后效果如下


免責聲明!

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



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