I've been using jqGrid since a couple of months and I'm really happy to do that :)
I'm using successfully jqGrid in a ASP.NET web application, everything works correctly. I decided to use jqGrid form editing, 'cause entities have a lot of properties I've to cope with. I understand that if colModel contains 5 cols they appear on the modal dialog form (edit action) if properties have editable:true. Moreover, I can set that 4 properties are visibile and last one is hidden (even if it can appear on the form, by setting edithidden: true).
Is there a way I can set 4 properties in the colModel, but there are one,two or much more fields in the popup modal form?
EDIT:
Please look at this code:
ajaxSelectOptions: { type: "POST", contentType: "application/json; charset=utf-8", }, colNames: [ 'ID', 'Code', 'Number', 'Floor (nr.)', 'Descr', 'Type', 'Create by', 'Creation date', 'Status', 'Features'], colModel: [ { name: 'ID', index: 'id', width: 10, align: "center", search: false, sorttype: 'int', searchoptions: { sopt: ['eq', 'ne', 'cn'] }, editable: false, editoptions: { readonly: true} }, { name: 'Code', index: 'Code', width: 20, align: "center", sorttype: 'text', searchoptions: { sopt: ['eq', 'ne', 'cn'] }, editable: false, editoptions: { readonly: true} }, { name: 'Number', index: 'Number', width: 20, align: "center", sorttype: 'int', searchoptions: { sopt: ['eq', 'ne', 'cn'] }, editable: true, editoptions: { size : 20 }, editrules: { required: true } }, { name: 'Floor', index: 'Floor', width: 30, align: "center", sorttype: 'int', search: false, edittype: 'select', editable: true, editoptions: { dataUrl: '<%# ResolveUrl("~/path/to/myCSharpWebService") %>', buildSelect: function (data) { var retValue = $.parseJSON(data); var response = $.parseJSON(retValue.d); var s = '<select id="myid" name="myid">'; if (response && response.length) { for (var i = 0, l = response.length; i < l; i++) { s += '<option value="' + response[i]["Id"] + '">' + response[i]["Descrizione"] + '</option>'; } } return s + "</select>"; } }, editrules: { required: true } }, { name: 'Descr', index: 'Descr', width: 40, align: "center", sorttype: 'text', editable: true, editoptions: { size: 10} }, { name: 'Type', index: 'Type', width: 50, align: "center", sorttype: 'text', edittype: 'select', editable: true, editoptions: { dataUrl: '<%# ResolveUrl("~/path/to/myCSharpWebService") %>', buildSelect: function (data) { var retValue = $.parseJSON(data); var response = $.parseJSON(retValue.d); var s = '<select id="myid2" name="myid2">'; if (response && response.length) { for (var i = 0, l = response.length; i < l; i++) { s += '<option value="' + response[i]["Id"] + '">' + response[i]["Descrizione"] + '</option>'; } } return s + "</select>"; } }, editrules: { required: true } }, { name: 'CreatedBy', index: 'CreatedBy', align: "center", search: false, sorttype: 'text', width: 40, searchoptions: { sopt: ['eq', 'ne', 'cn'] }, editable: false, editoptions: { readonly: true} }, { name: 'CreationDate', index: 'CreationDate', align: "center", search: false, sorttype: 'text', width: 30, searchoptions: { sopt: ['eq', 'ne', 'cn'] }, editable: false, editoptions: { readonly: true} }, { name: 'Status', index: 'Status', width: 50, hidden: true, edittype: 'select', editable: true, editrules: { edithidden: true, required: true }, editoptions: { dataUrl: '<%# ResolveUrl("~/path/to/myCSharpWebService") %>', buildSelect: function (data) { var retValue = $.parseJSON(data); var response = $.parseJSON(retValue.d); var s = '<select id="myid3" name="myid3">'; if (response && response.length) { for (var i = 0, l = response.length; i < l; i++) { s += '<option value="' + response[i]["Id"] + '">' + response[i]["Descrizione"] + '</option>'; } } return s + "</select>"; } } }, { name: 'Features', index: 'Features', width: 50, hidden: true, edittype: 'select', editable: true, editrules: { edithidden: true, required: true }, editoptions: { dataUrl: '<%# ResolveUrl("~/path/to/myCSharpWebService") %>', buildSelect: function (data) { var retValue = $.parseJSON(data); var response = $.parseJSON(retValue.d); var s = '<select id="myid4" name="myid4">'; if (response && response.length) { for (var i = 0, l = response.length; i < l; i++) { s += '<option value="' + response[i]["Id"] + '">' + response[i]["Descrizione"] + '</option>'; } } return s + "</select>"; } } } ], this is an extract of the function I use to create a grid on my aspx page. There are 10cols, as you can see from colModel, but just 7 of them are shown by jqGrid; I need the others 'cause I want to show them up in modal popup form when I edit a record on the grid.
Now, I'd like to write down cleaner code: I'd prefer to add these 3 more fields on edit button click when popup is built, instead of listing them in colModel