设置jQgrid可编辑文本框高度的格式 [英] Format jQgrid editable textbox height
问题描述
我正在使用jQgrid版本4.6.0(免费版本),并尝试编辑在Column模型中设置editable: true
时呈现的文本框的高度.我希望文本框高度适合整个网格单元.
I am using jQgrid version 4.6.0 (Free version) and trying to edit the height of textbox which gets rendered when we set editable: true
in Column model. I want the textbox height to fit into complete grid cell.
这里渲染的文本框的宽度很好并且适合单元格,但是如何增加文本框的height
呢?
Here the width of rendered textbox is fine and fits in the cell but how can I increase the height
of textbox?
试图实现:-
推荐答案
您可以使用一些技巧.您可以在列中editoptions
定义类似
There are some trick which you can use. You can editoptions
in the column defined something like
editoptions: { style: "height:40px;" }
它将在编辑期间创建的文本框中设置style
属性.我认为该技巧适用于您将要使用的任何编辑模式.
It will set style
attribute on the textbox creating during editing. I think that the trick will work for any editing mode which you will use.
更新:在使用情况单元格编辑的情况下,可以执行以下操作:
UPDATED: One can do the following in case of usage cell editing:
afterEditCell: function (rowid, cellname, value, iRow, iCol) {
var tr = this.rows[iRow], h = $(tr).height(),
$input = $(tr.cells[iCol]).find("input"),
delta = $input.outerHeight() - $input.height();
$input.height(h - delta);
}
在大多数回调中,this
将被初始化为<table>
元素的DOM(请参见单元格数组,可用于按单元格索引获取单元格.我希望其余的代码应该很清楚.
Inside of the most callbacks this
will be initialized to the DOM of the <table>
element (see here), which supports rows
property to quick access to the row by rowIndex
and the row (<tr>
) supports cells array which can be used to get the cell by cell index. The rest of the code should be clear I hope.
这篇关于设置jQgrid可编辑文本框高度的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!