How to Set Active Row During Page Load in Master Detail

Something like this would do the trick using jqGrid setSelection function:

$dg->before_script_end ='setTimeout(function(){jQuery("#TABLE_NAME").jqGrid("setSelection", <ROW_ID>, true);}, 1000);';

Above should be inserted before calling display() method.

To always select the first row regardless row id, use

var ids = $("#TABLE_NAME").jqGrid('getDataIDs');
$dg->before_script_end ='setTimeout(function(){jQuery("#TABLE_NAME").jqGrid("setSelection", ids[0], true);}, 1000);';

To expand subgrid during page load please see the following KB:

Feedback and Knowledge Base