layui table form field is too long, when the show is not complete, mouse over the top show full information

1, first Each column has a title, which put complete information, then write a following 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, just write function call data in table rendering done in complete callback

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();
     }
});

Guess you like

Origin www.cnblogs.com/uzxin/p/12090342.html