… or you could put your Javascript code into a template, e.g. like that:
MyComponent.js.tmpl: -------------------- $('#${markupId} .ttr').tipTip({defaultPosition: 'right'}); // ... some looooong Javascript block …. and in MyComponent.java you'd have: ----------------------------------- public class MyComponent extends Panel { public MyComponent(String id) { super(id); setOutputMarkupId(true); } @Override public void renderHead(IHeaderResponse response) { final TextTemplate template = new PackageTextTemplate( MyComponent.class, "MyComponent.js.tmpl"); final Map<String, Object> variables = new HashMap<String, Object>(); variables.put("markupId", getMarkupId()); // variables.put("foo", "bar"); etc. response.renderOnDomReadyJavaScript(template.asString(variables)); } } -Tom On 04.06.2012, 21:10 Martin Grigorov wrote: > For longer scripts you can create JS helpers like: > > in some.js: > var helper = function(selector) { > // something longer here > } > > is Some.java: > > response.renderOnDomReadyJavaScript("helper($('#" + getMarkupId() +"');"); --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org