Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Ruchi Dubey
Jquery stopped working after migration to liferay6
2. März 2012 01:16
Antwort

Ruchi Dubey

Rang: New Member

Nachrichten: 19

Eintrittsdatum: 28. Februar 2012

Neue Beiträge

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. März 2012 01:27
Antwort

Ravi Kumar Gupta

Rang: Liferay Legend

Nachrichten: 1303

Eintrittsdatum: 23. Juni 2009

Neue Beiträge

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. März 2012 01:45
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue Beiträge

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. März 2012 06:02
Antwort

Ruchi Dubey

Rang: New Member

Nachrichten: 19

Eintrittsdatum: 28. Februar 2012

Neue Beiträge

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. März 2012 08:22
Antwort

Ravi Kumar Gupta

Rang: Liferay Legend

Nachrichten: 1303

Eintrittsdatum: 23. Juni 2009

Neue Beiträge

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. März 2012 22:06
Antwort

Jitendra Rajput

Rang: Liferay Master

Nachrichten: 858

Eintrittsdatum: 7. Januar 2011

Neue Beiträge

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. März 2012 22:14
Antwort

Ruchi Dubey

Rang: New Member

Nachrichten: 19

Eintrittsdatum: 28. Februar 2012

Neue Beiträge

Doesn't work Ravi emoticon
Jitendra Rajput
RE: Jquery stopped working after migration to liferay6
5. März 2012 22:20
Antwort

Jitendra Rajput

Rang: Liferay Master

Nachrichten: 858

Eintrittsdatum: 7. Januar 2011

Neue Beiträge

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. März 2012 22:59
Antwort

Ravi Kumar Gupta

Rang: Liferay Legend

Nachrichten: 1303

Eintrittsdatum: 23. Juni 2009

Neue Beiträge

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. März 2012 04:44
Antwort

Ruchi Dubey

Rang: New Member

Nachrichten: 19

Eintrittsdatum: 28. Februar 2012

Neue Beiträge

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 D
RE: Jquery stopped working after migration to liferay6
1. Mai 2013 04:50
Antwort

Harish D

Rang: New Member

Nachrichten: 3

Eintrittsdatum: 28. Juli 2009

Neue Beiträge

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.