0

Problem with Liferay 7.3 and zk-Portlet

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

andij62 gravatar image andij62
315 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

Comments

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
0

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

cor3000 gravatar image cor3000
6280 2 7

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

Comments

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
0

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

andij62 gravatar image andij62
315 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;            
                        zk.rmDesktop();
                    });
                }   
            } catch(exc) {
                console.log("Failed " + exc.message);
            }
        });
link publish delete flag offensive edit

Comments

thanks for the solution for your scenario ... I can't verify it, nor do I know the specifics of the 'startNavigate' event, however it looks reasonable to me as it stands.

cor3000 ( 2020-07-20 14:18:15 +0800 )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

Follow
1 follower

RSS

Stats

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

Seen: 12 times

Last updated: Jul 14 '20

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