-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
if I call up a subpage in Liferay that contains a zk portlet and this portlet contains a datebox, the following error is output when the page is called up again in the safari browser with the zk portlet:
is there a workaround here?
there's no workaround for a missing method, it rather looks like the JS code is not the correct one ZK expects.
the Dates.newInstance
function returns a DateImpl object which has a tz()
function
This all happens in one JS file. So it's either the correct files or it isn't.
A potential cause for this could be mixed ZK versions. Maybe you have multiple portlet war files which use different ZK versions. Then inconsistent JS files can be loaded from different war files. ZK can't handle multiple versions inside the same browser tab.
So unfortunately I don't see a 'workaround' here, ZK it needs the correct/consistent JS files being loaded in order to function.
I only use one war file with all portlets. I use version 9.0.0.1 CE. This problem only occurs in the Safari browser and whenever I open the portlet then another page within Liferay and then open the portlet again. The first time everything works fine.
if it works once, and fails the second time I suspect a browser caching effect. in these cases looking into the network tab of the developer tools might give a clue about the loading order and the loaded contents from the server. any timing or content difference may cause side effects.
Watch out for ZK's js packages ending with '.wpd' those contain the JS for the client side widgets - including the code inside dateImpl.js.
I can't tell 'why'? however the error message is clear. When this error occurs the .tz
function doesn't exist on the _value object. As simple as that.
The most plausible reason for this to behave differently is differing code creating the _value
variable.
Differences in code can happen if conflicting code is loaded in a non deterministic order e.g. due to caching/network timing effects. Often the second time you open a page some scripts are already cached, hence load faster. However this is just a guess . The 'truth' (what's actually happening) should be visible in the browser's developer tools. Unfortunately I can't look into your application so I can only speculate.
If you an share an online accessible link I can have a look into your system. In case you can't share any code or link, this would be a case for our customer support where we can have a dedicated session to share screens to look into your system directly.
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);
}
});
Asked: 2020-06-28 23:28:32 +0800
Seen: 20 times
Last updated: Jul 14 '20