Problem with Liferay 7.3 and zk-Portlet

asked 2020-06-25 02:14:56 +0800

andij62 gravatar image andij62
307 1 7

updated 2020-07-01 16:28:10 +0800

Hi all,

I use a zk-portlet (MVC) with version 9 CE on one page in Liferay. Everything is working well. When i navigate to another page in Liferay that does not contain a zk portlet and then reduce the desktop-width there, the following error message is displayed:

"Desktop z5mo: /layout/test.zul] client error: processing failed _setAttra is undefined (TypeError) [Sanitized]"

In the zk-portlet I check the event "onClientInfo$mainWin" to display different layouts. If this event is expanded, the error will not be displayed! I think the event is still active even though the zk-portlet is not active. Can I check in the onClientInfo-event whether the zk portlet is still active? If that is possible i could exclude further processing.

Does anyone know what I can do here?

Regards Andi

delete flag offensive retag edit


Further research ... When I change sides in Liferay, the data is removed from the DOM, but the event "onClientInfo" remains. When I check in the event whether the desktop is still active with "desktop.isAlive", then "true" is still given to me and I cannot react to it and cancel the processing.

andij62 ( 2020-06-27 17:52:16 +0800 )edit

Can anybody help me further? Would be important!

andij62 ( 2020-07-01 16:27:29 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2020-07-02 12:23:19 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

Good finding, a clientInfo-event is still trying to fire after removing a portlet containing ZK content, indicates a bug. Setting up a liferay environment is quite an effort in order to reproduce an error, so I'll try to help by looking into static code.

From the client side source code it looks like there's not much happening

here the function that fires the event when resizing in au.js#L298-L303

here where the function is called from mount.js:L935

and here the listener calling this indirectly: https://github.com/zkoss/zk/blob/v9.0.0.1/zk/src/archive/web/js/zk/mount.js#L838

it doesn't look like it's unregistered anywhere ... can you provide the call stack of the JS error so I can be more certain I am looking at the right code. And potentially suggest a patch to fix this.

Also please verify that rmDesktop is called when the portlet is removed (that's the place that should deal with the cleanup)

link publish delete flag offensive edit


if things are too complex/inefficient/confidential to share in a forum, you can consider contacting our customer support

cor3000 ( 2020-07-02 12:25:31 +0800 )edit

answered 2020-07-14 00:34:41 +0800

andij62 gravatar image andij62
307 1 7

After trying it for a long time we found that it probably has to do with the SennaJS used in Liferay. The following Javascript snippet solves the problem:

        zk.afterLoad(function() {
            try {
                if( Liferay && zk ) {                               
                    Liferay.on('startNavigate', function(e) {   
                        zk.unloading = true;            
            } catch(exc) {
                console.log("Failed " + exc.message);
link publish delete flag offensive edit
Your answer
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

1 follower



Asked: 2020-06-25 02:14:56 +0800

Seen: 10 times

Last updated: yesterday

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