如何在jqgrid中限制行的最大高度 [英] How to restrict maximum height of row in jqgrid

查看:79
本文介绍了如何在jqgrid中限制行的最大高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

列包含多行长文本,这会使行高太大.

Column contains long multiline texts which make row height too big.

我根据Tony的回答尝试了以下样式 http://www .trirand.com/blog/?page_id = 393/help/possible-row-height-bug-in-in-ie8/

I tried styles below based on Tony's answer in http://www.trirand.com/blog/?page_id=393/help/possible-row-height-bug-in-in-ie8/

但那些不限制行的最大高度:行高仍然等于列中的行数.

but those do not limit row maximum height: Row height is still equal to by number of lines in column.

如何将行的最大高度限制为某个值?文本不应该换行(因为它已经在使用jqGrid默认设置)并且剩余的行不应该显示. (如果使用edittype textarea,则可以在编辑模式下检查整个文本).

How to limit maximum height of row to some value? Text should not wrap (as it already is using jqGrid default settings) and remaining rows should not shown. (Whole text can examined in edit mode if edittype textarea is used).

jqgrid tr.jqgrow td { 
  max-height  : 100px;
 }

ui-jqgrid tr.jqgrow td {
 max-height  : 100px;
 }

td {
  max-height  : 100px;
  }

tr {
  max-height  : 100px;
  }

推荐答案

您不能在tdtr元素上使用max-height,但是可以将多行文本放置在<div>内,一样的风格为此,您可以使用例如以下自定义格式化程序:

You can't use max-height on td or tr elements, but you can place the multiline text inside of the <div> having the same style. To do this you can use for example the following custom formatter:

formatter: function(v) {
    return '<div style="max-height: 100px">' + v + '</div>';
}

或将<div style="max-height: 100px">...</div>放在JSON/XML数据中.结果,您将获得类似

or place the <div style="max-height: 100px">...</div> inside of your JSON/XML data. As the result you will have something like

(我在截屏时显示了工具提示,以显示单元格中的数据包含更多的行,如网格中所示) 请参见相应的演示此处.

(I displayed tooltip during I made the screenshot to show that the data in the cell contain more lines as displayed in the grid) See the corresponding demo here.

这篇关于如何在jqgrid中限制行的最大高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆