-
1. Re: Javascript on page load
mstruk Mar 23, 2012 8:08 PM (in response to shannonsumner)This sounds like a known issue: GTNPORTAL-2374 Portlet edit mode css are broken in the page editor
-
2. Re: Javascript on page load
vstorm83 Mar 26, 2012 1:14 AM (in response to shannonsumner)@Shannon : Can you tell me which GateIn version you are using, and how do you add jQuery JS file to page, did you use Extra Markup Header ? There is a bug with Extra Markup Header with old GateIn version (extra headers are lost when Finish editing page) , but it has been fixed on the newest GateIn version
-
3. Re: Javascript on page load
shannonsumner Mar 26, 2012 10:55 AM (in response to vstorm83)Hello Vu,
I've added the javascript via a js-module in the portal skin.
Thanks,
Shannon
-
4. Re: Javascript on page load
vstorm83 Mar 26, 2012 10:20 PM (in response to shannonsumner)ok, so you use the gatein-resources.xml, right ?
Your jQuery js file will be merged in to merged.js file. Portal use Ajax when the page editing process is closed and return to normal page --> the browser is not refreshed and the merged.js file is still there on the html header.
Note that, it's an ajax request, so you shouldn't use the document.onload or DOMContentLoaded ($(document).ready()) JS event to initialize your portlet's html
-
5. Re: Javascript on page load
shannonsumner Mar 27, 2012 9:49 AM (in response to vstorm83)Hi Vu,
I am using the gatein-resources.xml. Are there any GateIn javascript activities for me to link against so I can can trigger my jQuery code upon their completion?
Thanks,
Shannon
-
6. Re: Javascript on page load
vstorm83 Mar 27, 2012 10:58 PM (in response to shannonsumner)1. You can add markup head elements in your portlet render phase. This is defined in portlet spec (JSR 286)
2. Just simply put your JS entry point code to the end of your portlet's html template. After Ajax request, portal will update your portlet html, and execute that JS code
3. Or you can use JavascriptManager that is a property of RequestContext: org.exoplatform.web.application.RequestContext.getCurrentInstance()
Then call org.exoplatform.web.application.JavascriptManager#addJavascript(String) --> call this in your portlet's render phase, this javascript snipet will be called after Ajax request has been finished
-
7. Re: Javascript on page load
shannonsumner Apr 26, 2012 10:48 AM (in response to vstorm83)Hello Vu,
I utilized the JavascriptManager to initiate my scripts and that worked wonderfully.
Thanks,
Shannon