layui table表格字段過長,展示不完整時,鼠標放到上面展示完整信息


1、首先每個列都有一個title,里面放入完整信息,然后寫一個如下的function,

1
2
3
4
5
6
7
8
function tdTitle(){
     $( 'th' ).each( function (index,element){
         $(element).attr( 'title' ,$(element).text());
     });
     $( 'td' ).each( function (index,element){
         $(element).attr( 'title' ,$(element).text());
     });
};

  2、在table數據渲染完的回調done中調用剛才寫的function

1
2
3
4
5
6
7
8
9
10
table.render({
   cols:  [[ //標題欄
     {checkbox: true }
     ,{field: 'id' , title: 'ID' , width: 80}
     ,{field: 'username' , title: '用戶名' , width: 120}
   ]]
   ,done: function (res){
         tdTitle();
     }
});


免責聲明!

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



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