0

label remove eventListener

asked 2014-03-12 16:17:26 +0800

javiut gravatar image javiut flag of Venezuela, Bolivarian Republic of
90 1 5

i have a label in a zul like this

 <label id="avalaibleLabel" value="Avalaible" onClick='controller.doAction();'/>

but later i need sometimes delete the onClick event how can i do this?

i am using MVC

any help is hugely appreciate..

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-03-12 20:21:41 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

Well I should add the eventlistener in the doAfterCompose of your controller. like this :

private EventListener buttonOnClickListener;

public void doAfterCompose (Component comp) throws Exception {
    super.doAfterCompose(comp);
    buttonOnClickListener = new EventListener() {
             public void onEvent(Event event) throws Exception {
                 //your code               
                     };
     // with mvc this button you must still wired it in your class(I don't put that code here))
     button.addEventListener("onClick",buttonOnClickListener);
}


public void removeEventListener() {
    button.removeEventListener("onClick",buttonOnClickListener);
}

so simpel as that.

Greetz chill.

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: 2014-03-12 16:17:26 +0800

Seen: 10 times

Last updated: Mar 12 '14

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