subGridRowExpanded: function (subgrid_id, row_id) {
var currentRow = $('#UtilitiesGrid').jqGrid('getRowData', row_id);
var utilityPrimaryKey = currentRow.UtilityId;
...
colNames: ['parentid','subid',...], //insert parentid column, hidden
colModel: [{name:"parentid", index:"parentid", hidden:true, editable:true,
editoptions: {
disabled:true, //dissabled in case colModel->hidden=false
value:utilityPrimaryKey , //Value for parentid in the add form
},
{name:"subid",index:"subid",key:true,hidden:true}
...
$("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{
add:true,
del:true,
refresh:true,
refreshstate:"current",
search:false,
},
{},//edit options
//add options
{recreateForm:true //since clearAfterAdd is trueby default, recreate the form so we re-establish value for parent id
});