Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I understand your question correct you will be able to implement your requirements by setting <code>readonly='readonly'</code> or <code>disabled='disabled'</code> attributes dynamically in <code>beforeShowForm</code> callback of the edit form.</p> <p>For general understanding it's important to know that when jqGrid create the edit form then it place all hidden fields in the form too. It simplify sending of hidden fields to the server on the form submit. So you can have in hidden columns of the grid any information which you plan to show in the edit form. Inside of your implementation of the <code>beforeShowForm</code> callback you can dynamically show the hidden fields, but set 'readonly' attributes if needed. The <code>'ID'</code>, <code>'Code'</code>, <code>'CreatedBy'</code> and <code>'CreationDate'</code> from your grid for example can be shown in the way.</p> <p>You can use additionally <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#column_chooser" rel="nofollow noreferrer">column chooser</a> to hide the columns initially, but allow the user to display the additional information if it's really needed. You can find <a href="https://stackoverflow.com/a/5901459/315935">here</a> an example of the usage of the column chooser.</p> <p>Some more general recommendation to your code. I would recommend you to use so named <a href="https://stackoverflow.com/a/7458069/315935">column templates</a> in your grid and to share the code of <code>buildSelect</code> which you use.</p> <p>For example, if you use <code>align: "center"</code> in the most columns of the grid you can use <code>cmTemplate: {align: "center"}</code> option of the jqGrid and remove <code>align: "center"</code> from every column. You can also define some templates which you use everywhere in all your grids as <code>template</code> parameter of colModel. In <a href="https://stackoverflow.com/a/6047856/315935">the answer</a> you will find an example of one simple <code>myDateTemplate</code> formatter. In case of the usage <code>datepicker</code> in the columns the template will be more complex, but the sharing of the code will be even more important. See <a href="http://www.ok-soft-gmbh.com/jqGrid/DialogAnimation.htm" rel="nofollow noreferrer">the demo</a> from <a href="https://stackoverflow.com/a/8786177/315935">the answer</a> or <a href="http://www.ok-soft-gmbh.com/jqGrid/DatepickerWithShowOnButton.htm" rel="nofollow noreferrer">the demo</a> from <a href="https://stackoverflow.com/a/8715319/315935">the another answer</a>.</p>
 

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