开发者

jqgrid - change column header name automatically according to the width

in my site , i have a jqgrid table.

by default, the names of the columns (header) is longer than the width for column, because that i set the name with an ellipsis.

however, when resizing the co开发者_JAVA技巧lumn, the short name with ellipsis stays.

how can i get it work automatic , like the ellipsis should disappear and change to the full name when there is enough space, when the user is expanding the column.

thanks


You can add an event handler after the resizing finishes to reset the names. How are you storing / changing the names? If they're in an array, you can add a function like:

var columnNames = ['first', 'second', 'third'];    
$("#mygrid").jqGrid({
   ...
   resizeStop: function(newwidth, index){ 
      jQuery("#mygrid").jqGrid('setLabel',index,columnNames[index]);
   },
   ...
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜