Hi Jorge,

thanks for the hint, unfortunately, this method is only available in Wicket 1.5 
-
in this projekt, I am still using Wicket 1.4. Maybe I should stop looking for
a general solution for this project and in the future use the solution you 
suggested...

J.


On 19.02.2012 10:30, Jorge Rodrigez wrote:
Hi,

I think you just need:

class MyComponent extends SomeWicketComponent {

   @Override public void renderHead(IHeaderResponse response) {
     response.renderOnDomReadyJavascript("someJSToExecute()");
   }
}

someJSToExecute() will be executed every time an instance of MyComponent is
rendered. Both Ajax and normal requests.

On Sat, Feb 18, 2012 at 5:46 PM, Jürgen Lind<juergen.l...@iteratec.de>wrote:

Hi Christoph,

thank you for your reply, I did not know that such a method exists (does
it for 1.4
or is this already Wicket 1.5). An secondly: are these handlers fired on a
ajax
update of an existing DOM Element or only when it is added?

And where would I put the Javascript that registers the handler? In the
Markup-Page of
the Component? How do I make sure, the handler is added only once?


J.


On 18.02.2012 17:39, Christoph Leiter wrote:

Hello Juergen,

you can register a function that gets called when wicket creates a new
element in the DOM:

Wicket.Event.subscribe('/dom/**node/added', function(element) {
      // do stuff
});

You can also use the '/dom/node/removing' channel.

Hope this helps.


Christoph




Jürgen Lind (2012-02-18 16:55):

Hi,

I was wondering if there is any kind of best practice to add specific
javascript
to a component. I often have the case, where a piece of javascript needs
to run
when the component is rendered as part of full-page request, and then
subsequently
as part of a self-triggered Ajax-Request or as part of an Ajax-Request
triggered
by another component.

I would like to have one place where I can put the Javascript and be
shure, it is
run every time...

Cheers,

J.


------------------------------**------------------------------**---------
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
For additional commands, e-mail: users-h...@wicket.apache.org



Mit freundlichen Grüßen,

Jürgen Lind


--
Dr. Jürgen Lind
iteratec GmbH                Fon: +49 (0)89 614551-44
Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
82008 Unterhaching           Web: www.iteratec.de

Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel

------------------------------**------------------------------**---------
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
For additional commands, e-mail: users-h...@wicket.apache.org




Mit freundlichen Grüßen,

Jürgen Lind

--
Dr. Jürgen Lind
iteratec GmbH                Fon: +49 (0)89 614551-44
Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
82008 Unterhaching           Web: www.iteratec.de

Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel

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

Reply via email to