Rahul Singh
Rahul Singh

Reputation: 21795

Format jQgrid editable textbox height

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.

enter image description here

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:-

enter image description here

Upvotes: 0

Views: 1830

Answers (1)

Oleg
Oleg

Reputation: 221997

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.

Upvotes: 1

Related Questions