Format jQgrid editable textbox height

十年热恋 提交于 2019-12-12 05:34:52

问题


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.

Here the width of rendered textbox is fine and fits in the cell but how can I increase the height of textbox?

Trying to achieve:-


回答1:


There are some trick which you can use. You can editoptions in the column defined something like

editoptions: { style: "height:40px;" }

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);
}

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.



来源:https://stackoverflow.com/questions/30482092/format-jqgrid-editable-textbox-height

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!