You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Doug Leeper <do...@yahoo.com> on 2007/10/18 05:11:57 UTC

Ajax question

I have a question that I hopefully someone will be able to answer.

I have created a Wicket based framework on top of YUI Context menu in
wicketstuff (menu2).  Everything works as expected.  It can be used on
Tree/Table for those that are interested.

However, the issue that I have come across is that the menu stops working
when I send back the component that the contextmenu is "listening" on.  I
understand that the DOM has changed and the menu needs to be recreated to
reestablish its association.  What I don't know is what is the best way to
reestablish the contextmenu.  I resend the Javascript to recreate the menu
but that doesn't work.  Is there something that I am missing?  How do I have
the YUI ContextMenu (in Javascript) re-listen on the recently sent
component?

Thanks in advance,
- Doug

P.S.  If you are interested in having a ContextMenu for your Wicket
Application, please check out package
org.wicketstuff.yui.markup.html.menu2.contextMenu.  Please be aware that
this is a work in progress but does work.  There is also a working example
in the wicketstuff-yui-examples.  I hope to have an example for Tree up very
soon.
-- 
View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13267305
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Doug Leeper <do...@yahoo.com>.
FYI...there is a working example of this problem in the
wicketstuff-yui-examples project under Context Menu 2 - Tree
-- 
View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13278196
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Doug Leeper <do...@yahoo.com>.
Gerolf...thanks for the tip.  Very useful tool.


Anyway I figured out a workaround.  I placed my tree in a div and had the
menu listen on the div for contextmenu events.  Even though I resend the
tree in an Ajax call, the contextmenu still works without resending the menu
creation stuff.
-- 
View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13296296
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Gerolf Seitz <ge...@gmail.com>.
On 10/19/07, Doug Leeper <do...@yahoo.com> wrote:
>
>
> At this point, I am not sure what I need to do to debug.  Is there any JS
>
debugging tools that I could use in Firefox that anyone would recommend?


you definitely want to use firefug [0] for that purpose.

Gerolf

[0] https://addons.mozilla.org/en-US/firefox/addon/1843


--
> View this message in context:
> http://www.nabble.com/Ajax-question-tf4644668.html#a13288186
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Ajax question

Posted by Doug Leeper <do...@yahoo.com>.
My Behavior extends AbstractDefaultAjaxBehavior which implements
IHeaderContributor.

There are no components involved except the one that is to be "listened" in
on for client side clicks.

At this point, I am not sure what I need to do to debug.  Is there any JS
debugging tools that I could use in Firefox that anyone would recommend?
-- 
View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13288186
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Matej Knopp <ma...@gmail.com>.
You should make your component implement IHeaderContributor. Or your
behavior, depends on how you implement your menu. Then you don't have
to worry about AjaxRequestTarget.

-Matej

On 10/18/07, Doug Leeper <do...@yahoo.com> wrote:
>
> I just found this.
>
> With a AjaxRequestTarget, you can get the HeaderResponse.
>
> Unfortunately, it still doesn't work :-(
> --
> View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13279426
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Doug Leeper <do...@yahoo.com>.
I just found this.

With a AjaxRequestTarget, you can get the HeaderResponse.

Unfortunately, it still doesn't work :-(
-- 
View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13279426
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by James McLaughlin <jo...@gmail.com>.
On 10/18/07, Doug Leeper <do...@yahoo.com> wrote:
>
> I am using 1.3 (Trunk).
>
> I am calling AjaxRequestTarget.target.appendJavascript() right after i call
> AjaxRequestTarget.target.addComponent().  Is this the right approach?
>
> Do I have access to IHeaderResponse in an Ajax call?

Have your component implement IHeaderContributor and override
 void renderHead(final IHeaderResponse response);

>
> Thanks
> - Doug
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Doug Leeper <do...@yahoo.com>.
I am using 1.3 (Trunk).

I am calling AjaxRequestTarget.target.appendJavascript() right after i call
AjaxRequestTarget.target.addComponent().  Is this the right approach?

Do I have access to IHeaderResponse in an Ajax call?

Thanks
- Doug


-- 
View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13277031
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax question

Posted by Matej Knopp <ma...@gmail.com>.
Hi, what wicket version are you using and how do you re-invoke the
javascript on ajax update? if you are using wicket 1.3 the best way to
do invoke the javascript is using
IHeaderResponse.renderOnDomReadyJavascript (works on regular page
refresh and also on ajax update).

-Matej

On 10/18/07, Doug Leeper <do...@yahoo.com> wrote:
>
> I have a question that I hopefully someone will be able to answer.
>
> I have created a Wicket based framework on top of YUI Context menu in
> wicketstuff (menu2).  Everything works as expected.  It can be used on
> Tree/Table for those that are interested.
>
> However, the issue that I have come across is that the menu stops working
> when I send back the component that the contextmenu is "listening" on.  I
> understand that the DOM has changed and the menu needs to be recreated to
> reestablish its association.  What I don't know is what is the best way to
> reestablish the contextmenu.  I resend the Javascript to recreate the menu
> but that doesn't work.  Is there something that I am missing?  How do I have
> the YUI ContextMenu (in Javascript) re-listen on the recently sent
> component?
>
> Thanks in advance,
> - Doug
>
> P.S.  If you are interested in having a ContextMenu for your Wicket
> Application, please check out package
> org.wicketstuff.yui.markup.html.menu2.contextMenu.  Please be aware that
> this is a work in progress but does work.  There is also a working example
> in the wicketstuff-yui-examples.  I hope to have an example for Tree up very
> soon.
> --
> View this message in context: http://www.nabble.com/Ajax-question-tf4644668.html#a13267305
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org