码迷,mamicode.com
首页 > Web开发 > 详细

mvc index 用table显示内容,文字过长时用......表示

时间:2015-07-17 11:30:25      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

 

此行是显示文字的内容,加载时自动调用commonSubstring()函数判断

{
title: ‘点评‘, field: ‘commonent‘, width: 180, resizable: true,
formatter: function (val, row)
{
var strcommon = "";
strcommon += "<font>" + commonSubstring(row.commonent) + "</font>";
return strcommon;
}
},

 

function commonSubstring(str) {
if (str != null) {
if (str.length > 20) {
var sub = str.substring(0, 20) + "......";
return sub;
} else {
return str;
}
}
if (str == null) {
return "";
}
}

 

mvc index 用table显示内容,文字过长时用......表示

标签:

原文地址:http://www.cnblogs.com/zxk3113/p/4653606.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!