close popup without dbr.refresh at end

(9 posts) (2 voices)

Tags:

No tags yet.

  1. john, Member

    I have a popup that does some operations on the table, run from a button.
    I previously was refreshing with select 'dbr.refresh'; at the end of the popup report
    It is an embeded report so just wanted to reload that report
    select 'dbr.embed_object', 'load1_result';
    I have other cell edits that reload just this embedded report
    when i copied the javascript from the end of those mydbr reports into the end of the one that runs in a popup the popup doesn't close, the table does reload though. here is the javascript

    select 'dbr.javascript', "
    {
    $('.load1')[0].click();
    }";

    How do i ask mydbr to close the popup window without a dbr.refresh at the end?

  2. john, Member

    edit, I posted incomplete code that embeds the report. here is complete code

    select 'dbr.report', 'sp_DBR_tcip_timenew2_sub1', 'load1_result', 'ingroupcol=ingroupcol';
    select 'dbr.button', '', 'invisible load1';
    select ingroupcol;

    select 'dbr.embed_object', 'load1_result';

  3. myDBR Team, Key Master

    It's bit unclear what are you trying to do. Couple of questions:

    - What does the 'sp_DBR_tcip_timenew2_sub1' do?
    - Why do you need a popup for it?
    - Do you do editing in the popup or do you just ask some parameters before running the linked report?
    - What do you want to happen once the linked report sp_DBR_tcip_timenew2_sub1 has been executed, just close the popup and do no changes in the main report or what?

    --
    myDBR Team

  4. john, Member

    Hi, see inline sorry my first post was confusing

    - What does the 'sp_DBR_tcip_timenew2_sub1' do?
    this is a subreport loaded on the main report (just displays data), i have 2 embedded reports and often refresh just one of them

    - Why do you need a popup for it?
    ooops sorry i probably wasn't clear. that is an embedded report that shows 1 table of data

    - Do you do editing in the popup or do you just ask some parameters before running the linked report?
    ask for one parameter then change multiple values and reload sp_DBR_tcip_timenew2_sub1

    - What do you want to happen once the linked report sp_DBR_tcip_timenew2_sub1 has been executed, just close the popup and do no changes in the main report or what?
    ooops sorry i was not clear, this is a report of one table that i reload.

    Here is the button code that runs the popup

    select 'dbr.report', 'sp_DBR_changetable','inid=in_id', 'popup'; select 'dbr.button', 'clickme'; select in_id;

    here is sp_DBR_changetable,
    i have played with different javascript after the .click() line but can't close popup. I think you are using jquery and I probably should be able to figure it out but i haven't been able to. I have made the window close with this, so at least i am trying to help myself :)
    self.close ();

    CREATE PROCEDURE `sp_DBR_changetable`(inid int, indecimal decimal(13,2)) BEGIN

    update sometable t2 set column = indecimal where id= inid;

    select 'dbr.javascript', " { $('.load1')[0].click();

    }";

    END

  5. myDBR Team, Key Master

    John,
    if your sp_DBR_changetable does not actually display anything, you do not need to use a popup. Just use an embeded element as a target

    select 'dbr.report', 'sp_DBR_changetable','inid=in_id', 'hidden_div[]';

    If you need to close or refresh the popup content via JavaScript, you can click the "close" or "refresh" links (shown as icons at top right of the popup window).

    --
    myDBR Team

  6. john, Member

    oh my gosh. that was so easy, thank you.

  7. john, Member

    I have another location i am trying to remove dbr.refresh and when i use 'hidden_div[]'; it always scrolls to bottom of page after clicking run report in popup The popup does disappear which is great. But i don't want the user to loose the location with a page reload or scrolling on page. This is a one table report with report linked to column

    i can choose where i scroll to (top of table or bottom ) by using
    'hiddendiv' instead of hidden_div[]
    and this code before or after select * from table;
    select 'dbr.embed_object', 'hiddendiv';

    I tired to replicate this scrolling on the previous report but i can't seem to, it has embedded reports so maybe that effects it ?

  8. john, Member

    sorry just noticed you said to click the close button via javascript, which would work if i leave the linked report as a popup. but i can't figure out the javascript.

    I have searched but can't find an example to copy, would you mind sharing an example ?
    thanks

  9. myDBR Team, Key Master

    You can update to the latest version, that should take care of the scrolling.

    In order to access the close-funtionality in a popup, remember that there can be multiple popup's open at the same time so the close action needs to be to the specific popup-window.

    Easiest way to close the popup window via JavaScript is to call function popupclose. It takes one parameter which can be any jQuery object inside the popup. The function will close the popup and call the callback function if assigned for that popup. There is a similar function available for refresh (popup_refresh).

    CREATE PROCEDURE `sp_DBR_changetable`(inid int, indecimal decimal(13,2))
    BEGIN update sometable t2
    set column = indecimal
    where id= inid; select indecimal as 'User input'; select 'dbr.html', 'Close'; END

    Alternatively, you can access the close, refresh and new_widow links in popup header directly using jQuery:

    $(this).closest('.mydbr_popupframe').find('th.border > a.close').click();

    There is also data-refreshurl and optional data-closecallback attributes in the popup frame containing the respective URL's if you need them.

    --
    myDBR Team


Reply

You must log in to post.