How To Restrict Jqgrid Textarea Height In Grid Only
Solution 1:
If I understand your problem correctly you can solve it in relatively easy way. You should just use CSS instead of inline styles for setting of max-height
of the div with multiline data. You can for example set some class on <td>
elements of the column having multiline elements using classes property of colModel
. For example is you would use classes: "textInDiv"
the <td>
of the cell in the corresponding column will get the class attribute. Because you have different hierarchy of elements inside of grid and inside of View form you can specify different restrictions of the height on both cases:
{name: "Description", edittype: "textarea", classes: "textInDiv",
formatter: function (v) {
return '<div>' + $.jgrid.htmlEncode(v) + '</div>';
}}
and
tr.jqgrow>td.textInDiv>div {
max-height: 20px;
overflow: auto
}
td.form-view-data>span>div {
max-height: 150px;
overflow: auto
}
The demo demonstrate the results. How you can see on the following pictures the max-height
for the cell contain is different for grid and the View form:
Post a Comment for "How To Restrict Jqgrid Textarea Height In Grid Only"