Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Ruchi Dubey
Jquery stopped working after migration to liferay6
2 mars 2012 01:16
Réponse

Ruchi Dubey

Rang: New Member

Publications: 19

Date d'inscription: 28 février 2012

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...
Ravi Kumar Gupta
RE: Jquery stopped working after migration to liferay6
2 mars 2012 01:27
Réponse

Ravi Kumar Gupta

Rang: Liferay Legend

Publications: 1182

Date d'inscription: 23 juin 2009

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
Hitoshi Ozawa
RE: Jquery stopped working after migration to liferay6
2 mars 2012 01:45
Réponse

Hitoshi Ozawa

Rang: Liferay Legend

Publications: 7990

Date d'inscription: 23 mars 2010

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
RE: Jquery stopped working after migration to liferay6
5 mars 2012 06:02
Réponse

Ruchi Dubey

Rang: New Member

Publications: 19

Date d'inscription: 28 février 2012

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...
Ravi Kumar Gupta
RE: Jquery stopped working after migration to liferay6
5 mars 2012 08:22
Réponse

Ravi Kumar Gupta

Rang: Liferay Legend

Publications: 1182

Date d'inscription: 23 juin 2009

Publications Récentes

Ruchi,
1
2<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
Jitendra Rajput
RE: Jquery stopped working after migration to liferay6
5 mars 2012 22:06
Réponse

Jitendra Rajput

Rang: Liferay Master

Publications: 709

Date d'inscription: 7 janvier 2011

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.
Ruchi Dubey
RE: Jquery stopped working after migration to liferay6
5 mars 2012 22:14
Réponse

Ruchi Dubey

Rang: New Member

Publications: 19

Date d'inscription: 28 février 2012

Publications Récentes

Doesn't work Ravi emoticon
Jitendra Rajput
RE: Jquery stopped working after migration to liferay6
5 mars 2012 22:20
Réponse

Jitendra Rajput

Rang: Liferay Master

Publications: 709

Date d'inscription: 7 janvier 2011

Publications Récentes

Ruchi ,


Look into below thread that might help you .

http://www.liferay.com/community/forums/-/message_boards/message/11954059
Ravi Kumar Gupta
RE: Jquery stopped working after migration to liferay6
5 mars 2012 22:59
Réponse

Ravi Kumar Gupta

Rang: Liferay Legend

Publications: 1182

Date d'inscription: 23 juin 2009

Publications Récentes

Probably because.. This is what DTD says
1
2Element : header-portal-javascript
3Set the path of JavaScript that will be referenced in
4 the page's header relative to the portal's context
5 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
RE: Jquery stopped working after migration to liferay6
6 mars 2012 04:44
Réponse

Ruchi Dubey

Rang: New Member

Publications: 19

Date d'inscription: 28 février 2012

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
RE: Jquery stopped working after migration to liferay6
1 mai 2013 04:50
Réponse

Harish Dhulipalla

Rang: New Member

Publications: 3

Date d'inscription: 28 juillet 2009

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.