Previously shown detail record still visible when master grid is refreshed

QuestionsPreviously shown detail record still visible when master grid is refreshed
Steve Christiansen asked 11 years ago

When I first load the master-detail grids, the detail grid is empty until a master record is selected that has a related detail record. When the master grid is reloaded, the previous detail record remains selected even though there is no selected master record.

How can this be prevented.

Thanks

10 Answers
Abu Ghufran answered 11 years ago

Hello,

I am unable to generate this issue. When we refresh master grid, all related details grids are refreshed.
However it is possible that the default sql in detail grid may be showing some results, otherwise it should show blank.

I'm also emailing you latest build and sample code.

Steve Christiansen answered 11 years ago

The latest build you sent added "Columns" to the toolbar but did not improve my master reload issue where the previously selected detail record remains.

All of your master-detail examples show a master without any col parameters assigned – $col = array();. I have too many columns in my master so have specifically assigned some columns to display where others are all hidden, although most are editable. Because columns are adjusted, I use

$g->set_columns($cols);
$out_master = $g->render("list1");

to display and render the master.

For the detail, I also assign columns for the same reason. When I used the same logic to display and render, I always got the assigned master columns as well as the detail columns on the detail grid. I thought that this might be happening because of the use of $g->set_columns($cols) in the detail; which would use the same var $cols as the master.

So, I modified the detail columns to $col1 and used

$g->set_columns($cols1);
$out_detail = $g->render("list2");

to display and render the detail.

This fixed the separation of the master and detail columns.

So, could either of these 2 scenarios be causing my reload issue which leaves the detail record displayed.
1. Using specific $col params in the master, which you do not use in the examples.
2. Using $cols and $cols1 in the master and detail respectively.

Or, is there anything else I should look for?

Abu Ghufran answered 11 years ago

Steve, i'll prepare a demo with above specs and will email you.

Abu Ghufran answered 11 years ago

I identified the issue and 've emailed you an update.

migul answered 10 years ago

When I first load the master-detail grids,
The detail grid is empty until a master record is selected (click)
that has a related detail record.
Sorry no english

Abu Ghufran answered 10 years ago

Hello,

It is designed to work this way.
What is your requirement. I can help after that.

Fernando Orti answered 10 years ago

I have the same issue that miguel Molina. I have a master grid and a detail grid.
I would like to be selected automatically the first row of the master grid and the detail grid is loaded with data according to the master´s selected row.

I've only managed to do the first part, with this code:

$e["js_on_load_complete"] = "grid_onload";
$g0->set_events($e);

function grid_onload(ids)
{

var grid = jQuery("#list0");
var ids = grid.jqGrid('getDataIDs');
// Select first row
jQuery("#list0").setSelection (ids[0], true);

}

The master grid´s first row is selected, but the detail grid does´nt load data. Can you help me to resolve this?

Abu Ghufran answered 10 years ago

Use some delay when calling setSelection. e.g.

Replace:
jQuery("#list0").setSelection (ids[0], true);

With:
setTimeout( function(){ jQuery('#list0').jqGrid('setSelection', ids[0], true); },500);

Fernando Orti answered 10 years ago

It works fine.
Thank you very much, Abu.

Your Answer

8 + 13 =

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?