Foren

Jquery stopped working after migration to liferay6

Ruchi Dubey, geändert vor 12 Jahren.

Jquery stopped working after migration to liferay6

New Member Beiträge: 19 Beitrittsdatum: 28.02.12 Neueste 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...
thumbnail
Ravi Kumar Gupta, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Beiträge: 1302 Beitrittsdatum: 24.06.09 Neueste 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
thumbnail
Hitoshi Ozawa, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste 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, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

New Member Beiträge: 19 Beitrittsdatum: 28.02.12 Neueste 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...
thumbnail
Ravi Kumar Gupta, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Beiträge: 1302 Beitrittsdatum: 24.06.09 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

New Member Beiträge: 19 Beitrittsdatum: 28.02.12 Neueste Beiträge
Doesn't work Ravi emoticon
thumbnail
Jitendra Rajput, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
Ruchi ,


Look into below thread that might help you .

http://www.liferay.com/community/forums/-/message_boards/message/11954059
thumbnail
Ravi Kumar Gupta, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

Liferay Legend Beiträge: 1302 Beitrittsdatum: 24.06.09 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

New Member Beiträge: 19 Beitrittsdatum: 28.02.12 Neueste 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 Dhulipalla, geändert vor 10 Jahren.

RE: Jquery stopped working after migration to liferay6

New Member Beiträge: 3 Beitrittsdatum: 29.07.09 Neueste 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.
thumbnail
Jitendra Rajput, geändert vor 12 Jahren.

RE: Jquery stopped working after migration to liferay6

Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste 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.