Reload master/detail grid after insert/update from a modal form

I have a form with a master detail. In the master detail is a grid. On the form is a button that links to another modal form to add or edit information shown in the master detail grid.

How can I make the master detail grid reload after I add or edit something in the modal form and close it.

sc_exit() isn’t what I need and reloading iframes with javascript doesn’t work.

This seems like logical functionality and I don’t understand why something this simple has to be so roundabout difficult.

Use sc_redir to the same form. It might be necessary to requery the correct master though.

1 Like

Can you help me how to sc_redir() to the parent form please?
I have a “calling” grid that opens another grid (modal) through a Link Button. The modal form performs some actions on the data dsipalyed by the calling grid.
I currently use “sc_exit();” to close the modal form and get back to the calling grid.
But the calling grid is not reloaded and therefore teh new rows are not visible.
Thx a lot for your assistance.

sc_redir(page_name,paremetername=whatever);

Hi nwdbs.
Thx for your answer.
My App is designed like this:

  • A menu with a few buttons
  • 1 button opens a grid on my clients
  • on each row I can open the client details in a tab within the Menu application
  • this client details App is a Form (master) with many details displayed as tabs within the form (blocks are set to be displayed as tabs)
  • 1 detail is a grid with the family members of the client
  • from this grid, I can open a modal app that performs actions through SQL. If I use “sc_redir()” from this modal form to get back to the family members grid, I get the following results:
    a. sc_redir(myApp, myParams) or sc_redir(myApp, myParams, “_self”) ==> the current modal form is replaced with the family grid. Does not get back to the actual “caller” (the modal form does not close)
    b. sc_redir(myApp, myParams, “_parent”) ==> this closes the modal form but then the parent of the family grid is replaced with MyApp. It is like one level is skipped
    c. sc_redir(myApp, myParams, “_blank”) ==> this closes the modal form and gets back to the caller family grid. But it is weird because the data are not reloaded … which is my goal here :slight_smile:
    Thx for your help

You should make your own closing button on the modal form.
and the type of button should be Javascript and then you put this code in the button code section

parent.location.reload();

This will cose the modal window and reloads the data.

Hello Kredt_st. Thx for your idea.
As my master App has several tabs, it does not work because when the Modal Form is closed, it gets back to the first tab (2) and not the tab where I was (1).

As my code is in the “OnFinish” event of a “Run” button, I had to do it the following way. First I had to find out about the name of the iFrame

*sc_redir(ClientDetails_Relations_Grid, prm_client_id_relation=[prm_client_id_rel_main], "_blank");*
  • echo “<script type=“text/javascript”>”;*
  • echo “parent.frames[“nmsc_iframe_liga_ClientDetails_Relations_Grid”].window.location.reload();”;*
  • echo “”;*
  • sc_exit();*