0

Event Listener not working

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

DaniloCaccia gravatar image DaniloCaccia
1

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");
                    refreshListaStazioni();
                }
            });

            window.doModal();
        }

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
0

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

MDuchemin gravatar image MDuchemin
1376 1 4
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

Follow
1 follower

RSS

Stats

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

Seen: 9 times

Last updated: Jun 27

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