On 12/11/06, Felix Shnir <[EMAIL PROTECTED]> wrote:
> I'm not sure why you guys find this such a tough issue?  The content of the
> Ajax call is populated into the content of the PWC.  That content it
> requested from the server via an ajax call.  Once the data gets loaded
> through an XHR, you can evaluate scripts.  Once scripts are downloaded and
> XHR switches to status 4, prototype evals and executes scripts (if any are
> set to execute).

What do you mean by "if any are set to execute?"  I admit that I am
relatively new to using PWC and there is probably something I need to
do that will seem obvious once I understand it.

> So what seems to be an issue?  Is the sample attached to the PWC download
> isn't enough?

The sample code is awesome. In fact, I may be guilty of not reading
the docs as carefully as I should because the examples make it so easy
to learn by example. To make this concrete, here is the code DIV I use
to do Dialog creation with AJAX loaded content:

    <div style="display:none" id="open_feedback_codediv">
        <xmp id="open_feedback">
        Dialog.confirm({url: "/components/feedback.jsp", options:
{method: 'get'}},
              {windowParameters: {className: "kdialog",  width:600,
height:350, zIndex: 1500, resizable:false, recenterAuto:false, title:
"Krillion Feedback...", showEffect:Effect.BlindDown, hideEffect:
Effect.Fade, draggable:true}, okLabel: "Send",
               buttonClass: "myButtonClass",
               id: "myDialogId",
               cancel:function(win) {},
               ok:function(win)
{sendFeedback(document.getElementById('feedForm'));
window.setTimeout(Dialog.okTimeout,1500)}
              });
        </xmp>
    </div>

The normal way in a regular HTML request response to get the round
corner effect is to make a NiftyLoad() javascript function call either
with the onLoad event handler for the page or by placing this
javascript call at the end of the BODY element of the response:

<script type="text/javascript">NiftyLoad();</script>

Neither approach works with my feedback.jsp response. I didn't expect
the onLoad event handler to work for an XHR, but, I had hoped placing
the call explicitly at the end of the feedback.jsp contents would. I
have since read on this mailing list that javascript specified in the
AJAX content loaded into the dialog will execute as a result of event
association with elements in the content when those elements are
clicked, but, inline script calls like the one above are not going to
be executed.

Although I am fairly new to AJAX, I do know how to register an event
handler for when the call returns. In this case, the libraries are
making the AJAX request. Not me. So, I haven't figured out how to
register my own event handler for when the XHR completes for the AJAX
content loaded into the Dialog PWC object.

As a workaround, I had used a setTimeout() call in my code DIV
javascript right after the call to Dialog.confirm() to make the
NiftyLoad() call after a specified delay. Of course, this is a hack
and I'm sure there is a more elegant way for me to do this. Plus, the
designer (and I agree with him) doesn't like the fact that there is a
delay where the dialog content first displays and then the corners get
rounded after the timeout interval. I must use a conservatively large
timeout to allow for variable time for response from server.

> Felix.

I'll go back and review the docs carefully again for information on
how to set scripts to execute upon completion of the loading of my
AJAX content into the dialog. I still don't understand how to do that
in a way that ties it to the XHR completion for my AJAX content.

-Van

-- 
- Mike "Van" Riper
  [EMAIL PROTECTED]

_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com

Reply via email to