Dropdown – subgrid

QuestionsDropdown – subgrid
Lars asked 11 years ago

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

2 Answers
Abu Ghufran answered 11 years ago

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>

eric carichon answered 10 years ago

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

Your Answer

12 + 2 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?