Forums de discussion

Jquery stopped working after migration to liferay6

Ruchi Dubey, modifié il y a 12 années.

Jquery stopped working after migration to liferay6

New Member Publications: 19 Date d'inscription: 28/02/12 Publications récentes
Hi,
I had portlets having jQuery 1.6.1 working with liferay5.2.3. I have migrated it to liferay6.0.6 and the jQuery functions are no longer working.I read on some posts that liferay6 doesnot support jQuery anymore. What should i do.Please help...
thumbnail
Ravi Kumar Gupta, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Publications: 1302 Date d'inscription: 24/06/09 Publications récentes
Its not true that JQuery is not supported. I have my ajaxjqueryportlet hosted on sourceforge which works fine on LR 6.0+. See the Error console if there is something you can find. But JQuery works for sure. emoticon
thumbnail
Hitoshi Ozawa, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
jQuery is not included by default in Liferay 6. You have to install it yourself.

http://www.liferay.com/web/nathan.cavanaugh/blog/-/blogs/using-jquery-or-any-javascript-library-in-liferay-6-0
Ruchi Dubey, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

New Member Publications: 19 Date d'inscription: 28/02/12 Publications récentes
Thanks Ravi and Hitoshi,
I found 1 thing: When i removed <header-portal-javascript>/js/jquery-1.6.1.js</header-portal-javascript> from liferay-portlet.xml and put <script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.1.js"></script> in the jsp itself my jquery is working.
I had my liferay-portlet.xml like:
<instanceable>false</instanceable>
<header-portlet-css>/css/portlet_usd_results.css</header-portlet-css>
<header-portlet-css>/css/TableTools.css</header-portlet-css>
<header-portal-javascript>/js/jquery-1.6.1.js</header-portal-javascript>
<header-portlet-javascript>/js/jquery.dataTables.js</header-portlet-javascript>
<header-portlet-javascript>/js/TableTools.js</header-portlet-javascript>
<header-portlet-javascript>/js/usd.generic.js</header-portlet-javascript>

What was wrong? This approach is working but not a good solution...
thumbnail
Ravi Kumar Gupta, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Publications: 1302 Date d'inscription: 24/06/09 Publications récentes
Ruchi,

<header-portal-javascript>/js/jquery-1.6.1.js</header-portal-javascript>


Only for this, Can you please try putting path along with portlet name. Like /portlet-name/js/jquery-1.x.js
Ruchi Dubey, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

New Member Publications: 19 Date d'inscription: 28/02/12 Publications récentes
Doesn't work Ravi emoticon
thumbnail
Jitendra Rajput, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

Liferay Master Publications: 875 Date d'inscription: 07/01/11 Publications récentes
Ruchi ,


Look into below thread that might help you .

http://www.liferay.com/community/forums/-/message_boards/message/11954059
thumbnail
Ravi Kumar Gupta, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Publications: 1302 Date d'inscription: 24/06/09 Publications récentes
Probably because.. This is what DTD says

Element : header-portal-javascript
Set the path of JavaScript that will be referenced in 
 the page's header relative to the portal's context 
 path.


Edit:

Jitendra/Ruchi.. It works if the javascript path is related to portal's context. I created a folder named js in tomcat/webapps and put jquery.js there. Then I tried to use jquery in portlet and it works fine. emoticon
Ruchi Dubey, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

New Member Publications: 19 Date d'inscription: 28/02/12 Publications récentes
Thanks Ravi and Jitendra for your replies.
Ravi I understand what you are saying, even i tried it but don't know why it is not working....will keep trying...
Harish Dhulipalla, modifié il y a 10 années.

RE: Jquery stopped working after migration to liferay6

New Member Publications: 3 Date d'inscription: 29/07/09 Publications récentes
Please check the path specified for js file. It should be in portal context path, i.e. starting with /html

<header-portal-javascript>/html/js/jquery-1.6.1.js</header-portal-javascript>

And the corresponding jquery-1.6.1.js file should be inside <liferay-tomcat-home>/webapps/ROOT/html/js/ folder.
thumbnail
Jitendra Rajput, modifié il y a 12 années.

RE: Jquery stopped working after migration to liferay6

Liferay Master Publications: 875 Date d'inscription: 07/01/11 Publications récentes
Even you can check if this Js is getting loaded or not from Mozila using firebug.( from net tab).

If its not getting loaded then you can try by changing path as suggested by ravi.