ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

ZK 5 / Liferay Integration - jquery conflict

fwe
22 Jan 2010 05:15:59 GMT
22 Jan 2010 05:15:59 GMT

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

samchuang
22 Jan 2010 05:42:04 GMT
22 Jan 2010 05:42:04 GMT

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

fwe
22 Jan 2010 06:00:13 GMT
22 Jan 2010 06:00:13 GMT

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?

samchuang
24 Jan 2010 17:35:09 GMT
24 Jan 2010 17:35:09 GMT

Hi

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

fwe
25 Jan 2010 02:12:54 GMT
25 Jan 2010 02:12:54 GMT

Hi,

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

fwe
27 Jan 2010 01:58:30 GMT
27 Jan 2010 01:58:30 GMT

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.

samchuang
28 Jan 2010 06:00:59 GMT
28 Jan 2010 06:00:59 GMT

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

fwe
28 Jan 2010 08:07:32 GMT
28 Jan 2010 08:07:32 GMT

Hi,

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

Thx.

samchuang
31 Jan 2010 19:47:45 GMT
31 Jan 2010 19:47:45 GMT

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

cherryportal
8 Feb 2010 06:01:59 GMT
8 Feb 2010 06:01:59 GMT

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 eoncherry@gmail.com

Have a nice day....

samchuang
12 Mar 2010 00:43:04 GMT
12 Mar 2010 00:43:04 GMT

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

fwe
17 Mar 2010 04:24:06 GMT
17 Mar 2010 04:24:06 GMT

Thanks a lot. Seems to work now :-)

wshun
1 Nov 2011 11:24:48 GMT
1 Nov 2011 11:24:48 GMT

    <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>	

We are using Liferay 5.2.3 as the interface for offering applications developed with the ZK framework (ZK-EE 5.0.9).
I added the above property to the \WEB-INF\zk.xml of the portlet, but because of this change the p_p_state=exclusive mode of a page fails loading.
There seems to be an jquery conflict.

samchuang
2 Nov 2011 09:26:29 GMT
2 Nov 2011 09:26:29 GMT

Hi

I don't know what's "p_p_state=exclusive mode", is't Liferay's setting ??

You can also refer to Liferay

kvegter
2 Nov 2011 11:59:53 GMT
2 Nov 2011 11:59:53 GMT

Hi

The p_p_state=exclusive is an liferay specific URL parameter to let the portlet provide all the content. The portal will than not put content 'around' the portlet content.

gr Kees