myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rafa PĂ©rez" <raja...@gmail.com>
Subject Re: [Trinidad] Using window.opener with Dialog Framework
Date Mon, 15 Dec 2008 10:40:54 GMT
tr:commandButton has an attribute 'returnListener' that points to a
method in the backing bean that gets executed when the dialog is
closed, i.e., when
RequestContext.getCurrentInstance().returnFromDialog() is called.
Maybe this is what you need.

HTH,

-- Rafa

On Mon, Dec 15, 2008 at 10:46 AM, James <jamiebarrow@gmail.com> wrote:
> Hi,
>
> I'm trying to access the window that open's my dialog using Javascript
> with window.opener, but this reference is null. What I'm trying to do
> is the following:
>
> 1. User selects items in a table on main page
> 2. User clicks button which opens dialog page containing a print view
> of the items
> 3. User closes the dialog page, once a javascript confirm passes, the
> main page submits to the backing bean which performs some processing,
> and the main page is then reloaded with the updated items
>
> 1 and 2 is fine, I have that working, its step 3 that I am having
> trouble with... it doesn't seem possible with the Trinidad Dialog
> Framework (maybe by design).
>
> Maybe some more clarification:
>
> ========
> main page:
> ========
> ...
> <script type="text/javascript">
> function callBack() {
>  alert('called');
>  if (confirm('Proceed')) {
>    // submit page to allow backing bean to process items
>  }
> }
> </script>
> ...
>  <tr:commandButton id="printButtonId"
>                    styleClass="button"
>                    text="Process"
>                    action="dialog:print"
>                    partialSubmit="true"
>                    useWindow="true"
>                    windowWidth="700"
>                    windowHeight="500"
>          />
> ...
>
> =====
> dialog
> =====
> ...
> <head>
> <script>
> function doOnunload() {
>  alert('doOnunload');
>  window.opener.callBack();
> }
> </script>
> </head>
> <f:view>
> <body onunload="doOnunload();">
> ...
>
> ---------------------------
>
> The alert('doOnunload') popup shows fine, so the javascript is being
> run, the problem is that window.opener is null. Anyone have any ideas
> how I can get my desired outcome? I hope I'm not being too vague.
>
> Thanks in advance,
>
> James Barrow
>

Mime
View raw message