Note that there are some explanatory texts on larger screens.

plurals
  1. POChange cell's edittype at edition in jqGrid
    primarykey
    data
    text
    <p>Is there any way, in cell editing, to change the edittype of a cell when it is being edited (if certain conditions are met)?</p> <p>Supposse I have a colModel that has a field "Description", which by default is going to be treated as an input. When I click to edit in that cell, and input is going to appear with the current cell value. Now, if certain condition is met, I'd like that when the user clicks that cell to edit it, instead of an input a select appears.</p> <p>I've tried using setColProp and changing both the edittype and the editoptions, but either I haven't done so in the right place (I did it in the beforeCellEdit event), or it doesn't work that way.</p> <p>Thanks.</p> <p><strong>UPD</strong>:</p> <p>I have tried to use the strategy you proposed, but my cell <em>still</em> shows an input after I invoke the <code>setColProp</code> method:</p> <pre><code>var originalEditCell = $.fn.jqGrid.editCell; $.jgrid.extend({ editCell: function (iRow, iCol, isStartEditing) { if (iCol === 4 &amp;&amp; classEditMode) { $(this).jqGrid('setColProp', "ColName4", { edittype: "text" }); var cell = $(this).find('tr:eq(' + iRow + ')').find('td[aria-describedby="gridFix_Description"]'); cell.find('select').remove(); cell.append($('&lt;input /&gt;').attr('id', iRow + '_Description') .attr('name', 'Description') .attr('role', 'textbox') .width('98%') .text("")); } return originalEditCell.call(this, iRow, iCol, isStartEditing); } }); </code></pre> <p>The grid still generates a select. Any idea why?</p> <p>Thanks</p> <p><strong>UPD2</strong></p> <p>Sorry, I had forgotten to include the correct variable for the colname in the setColProp method. I corrected that in the post to keep record of how I solved this issue if somebody else needs it.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload