Dear Abu. I have two master / detail grids. Grid 1 (master) has a field with values yes or no. I send this field as a parameter for the detail grid next to the ID. The detail grid table has the following fields: field1, field2, field3, field4, field5 and field6. If the master sends “YES”, I must display the following fields: field1, field2, field3, field4. But if you send “NO” it should show the fields: field1, field2, field5, field6. Is there any possibility that this can be done?
Currently it is not doable with master-detail grid. If you are using master-subgrid (nested grid) then it is doable.
Reason, in master-detail, both datagrids are loaded and structure is created. It only fetches data via ajax. Structure (fields) are not re-created on reload. Where as in subgrid, each time you press + on master row, complete grid is created again.
One option is to hide / show certain columns on loadComplete event.
if ( <yes is posted> ) { $opt["loadComplete"] = "function(){ $('#list1').jqGrid('hideCol', 'somecol1'); $('#list1').jqGrid('showCol', 'somecol2'); }"; } else { $opt["loadComplete"] = "function(){ $('#list1').jqGrid('hideCol', 'somecol2'); $('#list1').jqGrid('showCol', 'somecol1'); }"; }