格式化 jQgrid 可编辑文本框高度
Format jQgrid editable textbox height
我正在使用 jQgrid 版本 4.6.0(免费版)并尝试编辑当我们在 Column 模型中设置 editable: true
时呈现的文本框的高度。我希望文本框高度适合完整的网格单元格。
此处呈现的文本框的宽度很好,适合单元格,但如何增加文本框的 height
?
努力实现:-
您可以使用一些技巧。您可以在 editoptions
列中定义类似
的内容
editoptions: { style: "height:40px;" }
编辑时创建的文本框会设置style
属性。我认为该技巧适用于您将使用的任何编辑模式。
更新: 在使用单元格编辑的情况下,可以执行以下操作:
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(参见 here), which supports rows
property to quick access to the row by rowIndex
and the row (<tr>
) supports cells 数组,可用于获取单元格单元格索引。我希望其余的代码应该清楚。
我正在使用 jQgrid 版本 4.6.0(免费版)并尝试编辑当我们在 Column 模型中设置 editable: true
时呈现的文本框的高度。我希望文本框高度适合完整的网格单元格。
此处呈现的文本框的宽度很好,适合单元格,但如何增加文本框的 height
?
努力实现:-
您可以使用一些技巧。您可以在 editoptions
列中定义类似
editoptions: { style: "height:40px;" }
编辑时创建的文本框会设置style
属性。我认为该技巧适用于您将使用的任何编辑模式。
更新: 在使用单元格编辑的情况下,可以执行以下操作:
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(参见 here), which supports rows
property to quick access to the row by rowIndex
and the row (<tr>
) supports cells 数组,可用于获取单元格单元格索引。我希望其余的代码应该清楚。