I have a master/detail set of grids and want to hide the detail (in a certain situation) grid and show the record view of the first row of the detail grid. Is there a way to do this?
Thanks
Hello,
I reviewed your query but currently it is not supported as a function, work around could be …
You can hide whole grid, but moving it inside <div style='display:none'> … </div>
With onselectrow of master grid, it will auto refresh hidden detail grid.
On detail grid load, you can call a js code, that will check if first row is there, select that row and invoke click of view record button.
Code:
For detail grid, set:
$opt["loadComplete"] = "function(ids){ show_first_view(ids); }";
$grid->set_options($opt);
And in script tag of html,
function show_first_view(ids)
{
var grid = $("#list2");
if(ids.rows.length > 0) {
grid.jqGrid("setSelection", ids.rows[0]);
$("#view_list2").click();
}
}