datagrid文字省略显示,全文本悬浮显示!_____http://www.educity.cn/wenda/73553.html

来源:互联网 发布:flyme数据云同步 编辑:程序博客网 时间:2024/05/01 01:06

 <th field="content" width="80" align='center' formatter='formatContent'>内容</th>

  function formatContent(val, row) {
            if (val != null && val.length >= 20) {
                var content = val.substring(0, 20);
                return '<a  title="' + val + '"$amp;>apos;$ + content + '</a$amp;>apos;$;
            } else {
                return '<a  title="' + val + '"$amp;>apos;$ + val + '</a$amp;>apos;$;
            }
        }



xjh 20160121 亲测

if (val != null && val.length >= 40) {

                             var content = val.substring(0, 40);
                             return '<a  title="' +val+ '"$amp;>'+content+'</a$amp;>';
                         } else {
                             return '<a  title="' +val+ '"$amp;>apos;$'+val+'</a$amp;>';
                         }
0 0