0

ZK 5 / Liferay Integration - jquery conflict

asked 2010-01-22 05:15:59 +0800

fwe gravatar image fwe
18 1 1

updated 2010-01-22 05:17:49 +0800

Hi,

recently I've deployed my first ZK 5 Portlet in Liferay. Therefore I've followed the article http://docs.zkoss.org/wiki/ZK/How-Tos/Installation/How_to_Install_ZK_on_Liferay#Running_ZK_5_with_Liferay_5.2

After deploying the portlet in Liferay the ZK portlet showed up successfully. However all javascript-functionality of Liferay was broken now (no popups, no menu etc.). I think it's because Liferay brings its own jquery.js (Version 1.2.6), so there's a conflict with ZK jquery.js (1.3.x).

The following steps are necessary to fix the problem for me:
- Update Liferay jquery.js (version 1.2.6) to jquery.js (Version 1.3.2)
- Change zk.wpd in zk.jar and remove all jquery includes.

The solution seem to work but I don't like it very much. In a perfect world I would like to have all my ZK + jquery javascript files controlled and loaded centrally by Liferay. I do not want the ZK javascript files (<script> ... </script> within each Liferay ZK Portlet.

Is there any way (perhaps by configuration) to tell ZK not to load all javascript stuff for each portlet?

Thx a lot.

Cheers

delete flag offensive retag edit

14 Replies

Sort by ยป oldest newest

answered 2010-01-22 05:42:04 +0800

samchuang gravatar image samchuang
4084 4

Hi, the issue has been solve, you could refer to here

and just wait for new release

the wiki doc also add how to integrate with ZK5 and Liferay, refer to here

link publish delete flag offensive edit

answered 2010-01-22 06:00:13 +0800

fwe gravatar image fwe
18 1 1

updated 2010-01-22 06:02:11 +0800

Hi,

thx for your quick reply. But I'm already using ZK 5 RC2 (download it here)
Moreover I've defined the jQueryPatch in my zk.xml:

<?xml version="1.0" encoding="UTF-8"?>
<zk>
	<library-property>
		<name>org.zkoss.zk.portlet.PageRenderPatch.class</name>
		<value>org.zkoss.zkplus.liferay.JQueryRenderPatch</value>
	</library-property>
	<library-property>
		<name>org.zkoss.zkplus.liferary.jQueryPatch</name>
		<value>500</value>
	</library-property>
</zk>

However I still have the jquery conflict in Liferay. I've tested Liferay 5.2.3/ZK 5 RC2 with Firefox. The patch is only for IE right?

link publish delete flag offensive edit

answered 2010-01-24 17:35:09 +0800

samchuang gravatar image samchuang
4084 4

Hi

you have to wait the next fresh release to solve the problem with Liferay

link publish delete flag offensive edit

answered 2010-01-25 02:12:54 +0800

fwe gravatar image fwe
18 1 1

Hi,

thx a lot. I'll waiting for the upcoming release then.

link publish delete flag offensive edit

answered 2010-01-27 01:58:30 +0800

fwe gravatar image fwe
18 1 1

Hi,

yesterday I tested the Liferay integration with the new ZK5 release. It works fine with Firefox, IE7, IE8 (no jQuery conflict anymore :-)).

However it still doesn't work with IE6. As soon as I load the ZK 5 portlet with IE6 the browser freezes.

Any ideas to solve this issue?

Thx a lot in advance.

link publish delete flag offensive edit

answered 2010-01-28 06:00:59 +0800

samchuang gravatar image samchuang
4084 4

Hi ~~

Thanks for your response, I have tried, it does freezes, I am looking for reason and solution

The reason I think is it use jQuery ajax to load zul file, and I google, someone mention about using jQuery ajax will cause IE 6 crash, I am looking for solution now.

By the way, if you have time, you could post this bug to sourceforge

link publish delete flag offensive edit

answered 2010-01-28 08:07:32 +0800

fwe gravatar image fwe
18 1 1

updated 2010-01-28 08:08:25 +0800

Hi,

I've posted a bug issue (No. 2941611)

Thx.

link publish delete flag offensive edit

answered 2010-01-31 19:47:45 +0800

samchuang gravatar image samchuang
4084 4

updated 2010-01-31 20:50:42 +0800

Hi

After tracing, when we using this to fix the IE paring error, it using jQuery ajax to get zul page, and execute the javascript

<zk>
	<library-property>
		<name>org.zkoss.zk.portlet.PageRenderPatch.class</name>
		<value>org.zkoss.zkplus.liferay.JQueryRenderPatch</value>
	</library-property>
	<library-property>
		<name>org.zkoss.zkplus.liferary.jQueryPatch</name>
		<value>500</value>
	</library-property>
</zk>

the zul javascript may look like

<script  src="/zkau/web/js/zk.wpd"></script>
<script>alert('zk:' + window.zk)</script>
<script src="/zkau/web/js/zul.lang.wpd" ></script>

<script> ...............

we need the script to execute follow orders, 1 by 1.
It means after execute zk.wpd, the object window.zk should be ready to use, but it's null on IE6

unfortunately, when using jQuery append() to append javascript, in IE 6, execute javascript parallel, I don't know this issue is cause by jQuery append() or maybe it's IE6's bug, I also see some discussion on jQuery's forum, others also has this issue, but I don't find any solution

if anyone knows how to solve this issue, please let me know

link publish delete flag offensive edit

answered 2010-02-08 06:01:59 +0800

cherryportal gravatar image cherryportal
3

Hello Friends,

AukCell is a Liferay portal focused IT company based in Beijing and Dalian ,China, they have been provide cost effective solutions based on liferay portal ,including the Liferay Integration, Customization , theme design ,portlet development ,if you need liferay support on the development ,please feel free to contact with me at [email protected]

Have a nice day....

link publish delete flag offensive edit

answered 2010-03-12 00:43:04 +0800

samchuang gravatar image samchuang
4084 4

Dear all

after countless trying, finally find a way to let Liferay work on IE6, the soultion is use Liferay to load ZK javascript lib, here are the steps

fixed time: 2010/03/12

please use "JQueryRenderCachedPatch" to fix problem on IE6

Steps:
1.in zk.xml, add library-property
<library-property>
<name>org.zkoss.zk.portlet.PageRenderPatch.class</name>
<value>org.zkoss.zkplus.liferay.JQueryRenderCachedPatch</value>
</library-property>

2.in liferay-portlet.xml, use Liferay to load zk javascript file
<portlet>
....
<header-portlet-javascript>/zkau/web/js/zk.wpd</header-portlet-javascript>
....
</portlet>

this step is very important, because this patch assume ZK javascript file has loaded by Liferay,
so make sure in the html header, you could see the file of zk.wpd

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-01-22 05:15:59 +0800

Seen: 3,922 times

Last updated: Nov 02 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More