you should implement the IHeaderContributor interface in your page and use IHeaderResponse.renderOnLoadJavascript() method in the implementation of the renderHead method..


Ernesto Reinaldo Barreiro wrote:
Something like:

HTML

<wicket:extend>   <script wicket:id="script"
type="text/javascript">alert('Hi');</script>
      .....
</wicket:extend>

Java code:

Label script = new Label("script", new Model<String>()) {
private static final long serialVersionUID = 1L;

@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
openTag) {
StringBuffer sb = new StringBuffer();
sb.append("var ");
// some more Javascript code...
replaceComponentTagBody(markupStream, openTag, sb.toString());
}
};
addOrReplace(script);

does not work? I use that kind of things for panel and works just fine...
That should also work for extend...

Best,

Ernesto

On Tue, Nov 25, 2008 at 3:08 PM, itayh <[EMAIL PROTECTED]> wrote:

Hi,

I use Markup inheritance in my site in order to keep common logic in the
base page.
I would like my child pages to do certain javascript actions when they are
loaded. I try to define the the javascript on the childs body (between the
<wicket:extend> and </wicket:extend>) but I don't see them in the generated
page (the base + child page). Any Idea how to generate onLoad javascript
action for child page?
--
View this message in context:
http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20681885.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to