Selection in a Master Detail Grid

QuestionsSelection in a Master Detail Grid
Gary Wilson asked 2 years ago

I have a master detail grid which works exactly as I need. For example, selection of a 2022 car in the master grid results in all 2022 cars in the detail grid below. However, I have a filter which allows a soft match of +/- 1 year so 2021 cars would also be shown if this is selected.

The issue is after I select the filter. I need the car in the master grid to be automatically re-selected to force the detail grid to refresh.

2 Answers
Abu Ghufran Staff answered 2 years ago


If you wish to select a row in master grid programmatically, you can have this code:

$('#list1').jqGrid('setSelection', rowid, true);

Here rowid and list1 are to be replaced with you row to be selected id, and your grid id.

This will reload the detail grid.

If your master grid have multiple selection enabled, all the selected row ids are passed to detail grid in querystring parameters. So when fetching the data in detail grid, you can use those ids in the select query of detail grid, e.g. SELECT…. WHERE parent_ids IN ( $ids )

If you have any issue in implementing this, You can share your code and screenshot to explain further and I’ll suggest the changes.

Abu Ghufran - Dev Team
Grid 4 PHP Framework
Gary Wilson answered 2 years ago

Hi Abu,

Thanks as always for the response.

I tried the above and it does not seem to work. The row selection is made but the detail table is not updated. So I tried to force a click using a document.getElementById(“23456”).click() where 23456 is the row id. The trouble is that if I place this in the function called when loading complete on the master grid, it seems too early for the detail grid to load, i.e. nothing happens. if I invoke the click in the function called when loading complete on the detail grid, it cycles around since the click in master causes the detail to refresh causing another click, etc.

Thanks in advance


Your Answer

12 + 11 =

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?