[
http://issues.apache.org/jira/browse/TAPESTRY-788?page=comments#action_12359215
]
Raphael Jean commented on TAPESTRY-788:
---------------------------------------
Here is a replacement for the PageRenderSupportImpl.writeInitializationScript()
method.
It uses the window.onload event handler to run the initialization script, but
is nice with other portlets handlers by setting up a handler chain.
public void writeInitializationScript(IMarkupWriter writer)
{
if (!any(_initializationScript))
return;
writer.begin("script");
writer.attribute("language", "JavaScript");
writer.attribute("type", "text/javascript");
writer.printRaw("<!--\n");
String previousOnload = getUniqueString("previousWindowOnload");
writer.printRaw("var " + previousOnload + " = window.onload;\n");
writer.printRaw("window.onload = function() {\n");
writer.printRaw("if (");
writer.printRaw(previousOnload);
writer.printRaw(")\n\t");
writer.printRaw(previousOnload);
writer.printRaw("();\n");
writer.printRaw(_initializationScript.toString());
writer.printRaw("}\n");
writer.printRaw("\n// -->");
writer.end();
}
> DatePicker doesn't work in a portlet. Initialization script is run before
> window finishes loading.
> --------------------------------------------------------------------------------------------------
>
> Key: TAPESTRY-788
> URL: http://issues.apache.org/jira/browse/TAPESTRY-788
> Project: Tapestry
> Type: Bug
> Components: Portlet
> Versions: 4.0
> Environment: Tapestry 4.0-beta-13
> Jetspeed 2 portal
> Reporter: Raphael Jean
>
> When using a DatePicker in a Tapestry portlet, IE displays an error message
> during page loading and aborts:
> "Internet Explorer cannot open the site http://localhost. Operation aborted"
> It appears that this is caused by the initialization script of the DatePicker
> component being run before the window finishes loading. The script is run
> right before the portlet finishes rendering, which, in a portal environment,
> is not necessarily the end of the page.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]