Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Thomas Götz
What about this? public class MyComponent extends Panel { public MyComponent(String id) { super(id); setOutputMarkupId(true); } @Override public void renderHead(IHeaderResponse response) { response.renderOnDomReadyJavaScript( $('# +

Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Jürgen Lind
Thomas, thanks for this hint, didn't know about that... So the script is executed every time the component is updated in an ajax call, correct? If so, it would surely solve some of my issues. For longer scripts, I would still prefer to have them in the markup file (might be different if we

Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Martin Grigorov
On Mon, Jun 4, 2012 at 10:01 PM, Jürgen Lind juergen.l...@iteratec.de wrote: Thomas, thanks for this hint, didn't know about that... So the script is executed every time the component is updated in an ajax call, correct? If so, it would surely solve For every rerender of the component. That

Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Jürgen Lind
Thanks Martin, maybe I should have asked before trying to invent my own stuff... Anyway, developing a new wicket tag was some kind of fun as well... J. On 04.06.2012 21:10, Martin Grigorov wrote: On Mon, Jun 4, 2012 at 10:01 PM, Jürgen Lindjuergen.l...@iteratec.de wrote: Thomas, thanks

Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Thomas Götz
… or you could put your Javascript code into a template, e.g. like that: MyComponent.js.tmpl: $('#${markupId} .ttr').tipTip({defaultPosition: 'right'}); // ... some long Javascript block …. and in MyComponent.java you'd have: --- public

Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Martin Grigorov
On Mon, Jun 4, 2012 at 10:22 PM, Jürgen Lind juergen.l...@iteratec.de wrote: Thanks Martin, maybe I should have asked before trying to invent my own stuff... Anyway, developing a new wicket tag was some kind of fun as well... I'm glad you have fun but I highly recommend staying away from

Re: Component-specific javascript in Ajax-Calls

2012-06-04 Thread Jürgen Lind
Martin, ok, I will think about going to one of the ideas Thomas suggested. I still like the idea that I have my javascript only in the markup file and nothing in the Java class, though... Thanks again, J. On 04.06.2012 21:25, Martin Grigorov wrote: On Mon, Jun 4, 2012 at 10:22 PM, Jürgen