0

Problem with Liferay, zk-Portlet and Datebox

asked 2020-06-28 23:28:32 +0800

andij62 gravatar image andij62
307 1 7

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:

image description

is there a workaround here?

delete flag offensive retag edit

7 Answers

Sort by ยป oldest newest most voted
0

answered 2020-06-29 10:40:08 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

updated 2020-06-29 10:40:34 +0800

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.

link publish delete flag offensive edit
0

answered 2020-06-29 10:42:04 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

Another potential cause is custom JS code or patches for bugs in older ZK versions that need to be removed in newer versions where the patched issue is already fixed.

link publish delete flag offensive edit
0

answered 2020-06-29 16:03:11 +0800

andij62 gravatar image andij62
307 1 7

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.

link publish delete flag offensive edit
0

answered 2020-06-30 14:16:52 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

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.

link publish delete flag offensive edit
0

answered 2020-06-30 21:50:31 +0800

andij62 gravatar image andij62
307 1 7

I see where the problem is, but I don't know why it doesn't work in Safari on the second call

image description

image description

link publish delete flag offensive edit
0

answered 2020-07-02 12:04:46 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

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.

link publish delete flag offensive edit
0

answered 2020-07-14 00:37:21 +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;            
                    zk.rmDesktop();
                });
            }   
        } 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

Follow
1 follower

RSS

Stats

Asked: 2020-06-28 23:28:32 +0800

Seen: 18 times

Last updated: yesterday

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