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-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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)
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 )editAfter 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);
}
});
Asked: 2020-06-25 02:14:56 +0800
Seen: 12 times
Last updated: Jul 14 '20
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 )editCan anybody help me further? Would be important!
andij62 ( 2020-07-01 16:27:29 +0800 )edit