码迷,mamicode.com
首页 > 其他好文 > 详细

jqgrid中实现前台界面显示字符长度固定,后面用省略号代替

时间:2014-10-24 19:12:33      阅读:321      评论:0      收藏:0      [点我收藏+]

标签:function   center   false   前台   title   

  1. jqgrid中加入formatter

{index:‘authenticationFunction‘,name:‘authenticationFunction‘,align:"center",title:false,formatter:StrLenFormat},

 

2.引入包

<script type="text/javascript" src=\‘#\‘" %>/quality/js/strgride.js"></script>

 

3.js文件如下

function StrLenFormat(cellvalue, options, rowObject){
  var oldstrlen=cellvalue.length;
 
  var newstr="";
     
   if(oldstrlen>10){
     newstr=cellvalue.substring(0,10)+"...";
    
     newstr="<div title=‘"+cellvalue+"‘>"+newstr+"</div>";
   }else{
     newstr=cellvalue;
   }
  return newstr;
}

本文出自 “8812323” 博客,请务必保留此出处http://8822323.blog.51cto.com/8812323/1567587

jqgrid中实现前台界面显示字符长度固定,后面用省略号代替

标签:function   center   false   前台   title   

原文地址:http://8822323.blog.51cto.com/8812323/1567587

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