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

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

你可能感兴趣的:(function,title,false,前台,center)