Event Listener not working

asked 2019-06-26 18:04:05 +0800

DaniloCaccia gravatar image DaniloCaccia

Hi, i'm trying to use an event listener to refresh a parent window from onClose event of child window.

This in parent window to open another window:


            window = (Window)Executions.createComponents(componentFileName, null, requestData);

            window.addEventListener("onClose", new EventListener<Event>() {
                public void onEvent(Event event) {
                    System.out.println("SONO NELL'EVENT LISTENER");


in the new page i have:


    System.out.println("STO CHIUDENDO QUESTA FORM");
    Event closeEvent = new Event( "onClose", this.getSelf(), null ) ;
    Events.postEvent( closeEvent );

i have tried these two methods in two others projects and all works fine, can someone tell what can i try? thanks in advance.

P.S. sorry for my bad english :D

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-27 19:01:20 +0800

MDuchemin gravatar image MDuchemin
1743 1 5
ZK Team

Hi DaniloCaccia,

Could be a few scenario where the event wouldn't reach the outer window, but from your code it looks like you are creating an event with the inner window as target.

I'd say try using new Event("onClose",null,null) since passing a target component will restrict to listeners declared on the same comp. (or new Event("onClose",targetWindow,null) if you have access to the target object.

can you make a zkfiddle sample to review the full class?

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




Asked: 2019-06-26 18:04:05 +0800

Seen: 15 times

Last updated: Jun 27 '19

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