Note that there are some explanatory texts on larger screens.

plurals
  1. POJqgrid setting a select in Editform
    primarykey
    data
    text
    <p>Heres the deal, I have a JqGrid with a column("Status") with 3 possible numbers that I format(and unformat) to 3 different icons in the grid. But I need to format those numbers as a select type with a selected option when im in Edit mode. Iv done that but the combo in Editform shows without any preloaded selection from the grid even if it has a value. Any row I select in the grid comes in EditForm with the same combo value. But if I select any option in Editform and save it, it will update normally. What am I missing?</p> <p><strong>Colmodel definition of the status:</strong></p> <pre><code>colModel:[ {name:'status_solicit_vale',index:'status_solicit_vale',width:120, align:'center', formatter:'iconFmatter', unformat:'iconUnFmatter', stype:'select', editable: true, searchoptions:{value:":Todos;0:Aguardando;1:Autorizado;2:Rejeitado"}, edittype:"select", editoptions:{value:"0:Aguardando;1:Autorizado;2:Rejeitado"} } ], </code></pre> <p><strong>EditOptions definition:</strong></p> <pre><code>{ Modal:true, reloadAfterSubmit : true, recreateForm : true, closeAfterEdit : true, closeAfterAdd : true, reloadAfterSubmit: true, checkOnSubmit: true, closeAfterEdit: true, bClose: "Fechar", saveData: "Confirma alteração?", bYes : "Sim", bNo : "Não", bExit : "Cancelar", afterSubmit: function () { jQuery("#gridJson").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); return [true,'']; // no error } }, // EDIT OPTIONS </code></pre> <p><strong>Format and unformat for the icons in the grid:</strong></p> <pre><code>iconFmatter : function(cellvalue, options, rowdata) { switch(cellvalue){ case 0: var html = '&lt;div class="ui-state-attention ui-corner-all" style="display:table"&gt;&lt;span class="ui-icon ui-icon-alert" title="Aguardando" id=0&gt;&lt;/span&gt;&lt;/div&gt;'; break; case 1: var html = '&lt;div class="ui-state-check ui-corner-all" style="display:table"&gt;&lt;span class="ui-icon ui-icon-check" title="Autorizado" id=1&gt;&lt;/span&gt;&lt;/div&gt;'; break; case 2: var html = '&lt;div class="ui-state-error ui-corner-all" style="display:table"&gt;&lt;span class="ui-icon ui-icon-closethick" title="Rejeitado" id=2&gt;&lt;/span&gt;&lt;/div&gt;'; break; default: html = "ERRO"; break; } return html; }, iconUnFmatter : function(cellvalue, options, cell) { return $('span', cell).attr('id'); } </code></pre> <p><img src="https://i.stack.imgur.com/8sMB9.png" alt="Jqgrid select"></p>
    singulars
    1. This table or related slice is empty.
    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.
    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