Hello – great grid!
I have a dropdown on a add-form in a subgrid. I need to update the contents in the dropdown after adding a record to the subgrid. I can do this on the -+ button in the mastergrid. I try to refresh subgrid after adding a record – but i doesn't work. I can do a refresh on the mastergrid – it works – but it closes the subgrid.
Any ideas?
BR Lars
Hello,
Q) How to keep subgrid expanded after parent grid's refresh ?
Following JS code snippet will keep subgrid opened after parent's refresh.
You can place this script with parent grid's code.
PHP Part:
// reload previous expanded subgrids on load event
$e["js_on_load_complete"] = "grid_onload";
$grid->set_events($e);
JS Part:
<script>
var scrollPosition = 0
var ids = new Array();
function grid_onload()
{
jQuery.each(ids, function (id,data) {
$("#list1").expandSubGridRow(data);
jQuery("#list1").closest(".ui-jqgrid-bdiv").scrollTop(scrollPosition);
});
}
// custom refresh button
jQuery(document).ready(function(){
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager',
{
'caption' : 'Refresh',
'buttonicon' : 'ui-icon-extlink',
'onClickButton': function()
{
ids = new Array();
$('tr:has(.sgexpanded)').each(function(){ids.push($(this).attr('id'))});
scrollPosition = jQuery("#list1").closest(".ui-jqgrid-bdiv").scrollTop()
$("#list1").trigger("reloadGrid");
},
'position': 'last'
});
});
</script>
Hello,
I need to retrieve the id of the master grid to power a "select" with> get_dropdown_values ("SELECT
problem, you must reload the page to get the last id?
how to:
– Retrieve the id (I already used $ id = intval ($ _GET ["rowid"]), but this does not work if I did not reload the page)
– Reload the page each time you click on a grid line 1
Alternatively or if there is a
thank you in advance for your help
eric carichon