Linked Popup Report Refresh

(3 posts) (2 voices)

Tags:

No tags yet.

  1. brycedcamp, Member

    I have a combination of reports that use layers of popups to achieve data creation, update and deletions. This is the starting report code:

    select 'dbr.report', 'sp_DBR_popup_report1', 'popup', 'infield1=[field1]';

    select field1, field2 from table1;

    Within the popup window, a second popup is created that performs an action such as deleting the source record:

    select 'dbr.report', 'sp_DBR_popup_report2_del', 'popup_second', 'infield1=[infield1]';

    delete from .....

    This code works great but the popup doesn't close. I have to close it manually and then refresh the previous popup. How can I automatically close popup_second and refresh the original popup window to reflect the change without using 'dbr.refresh' ?

  2. myDBR Team, Key Master

    Bryce,
    it the 'sp_DBR_popup_report2_del' does nothing more than deletes the selected row, you do not need to open it in a popup. What you can do instead, is to direct the output from it to a dynamic (or predefined) embedded element. The output can call myDBR's popup_refresh-function.

    When you create a the first popup with:

    select 'dbr.report', 'sp_DBR_popup_report1', 'popup', 'infield1=[field1]';

    myDBR creates a popup element that contains a DIV with ID 'popup'. Instead of creating a second popup for the delete, you can do:

    select 'dbr.report', 'sp_DBR_popup_report2_del', 'dynamic[]', 'infield1=[infield1]';

    This will call the delete report and check it the document contains an element with ID 'dynamic'. If no such exists, myDBR will create one for you (the []-syntax). Any output from the sp_DBR_popup_report2_del, will be put in this element. To do the refresh, you can call the popup_refresh-function with ID telling which popup to refresh. In this case it would be 'popup'.

    So the content for the sp_DBR_popup_report2_del-report would look like this:

    -- No need for the title
    select 'dbr.title', '';
    -- Do the delete
    delete from...
    -- Refresh the popup
    select 'dbr.javascript', 'popup_refresh("popup");';

    The parameter for popup_refresh can be a string (myDBR will look for the ID with same name) or a CSS selector (.class or #id),

    --
    myDBR Team

  3. brycedcamp, Member

    This works great, thank you


Reply

You must log in to post.