0

How to fire onClick event by coding

asked 2010-02-15 04:25:35 +0800

Thiru gravatar image Thiru
147 5

Hi Everyone,

I'm using one div and added onClick eventlistener. this event is working fine, when we click the div.
My problem if some time i need to fire the div onClick event automatically with out clicking from ui. how can i fire an event.
i have tried div.fireEvent("onClick") it is not working. i'm using zk .3.5.6 version

Thanks in Advance
Thiru

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-02-15 06:38:17 +0800

TOtte gravatar image TOtte
93 2

I don't know if thats possible, but even if it is there should be a better solution.

If you have a method onClick$idofthediv(ForwwardEvent event) in your controller and you need the code inside to be executed in other cases too, then you should just do

onClick$idofthediv() {
doSomething()
}

doSomething() {
....
}

So from your other method you can just call the doSomething() method and you get the same result.

link publish delete flag offensive edit

answered 2010-02-18 03:07:06 +0800

xmedeko gravatar image xmedeko
1031 1 16
http://xmedeko.blogspot.c...

Yeah, TOtte, it's the preferred way.

But sometimes, you need to fire an event. Look at Events.postEvent(..). But it's better to avoid that.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-02-15 04:25:35 +0800

Seen: 1,930 times

Last updated: Feb 18 '10

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