0

How to add "onClick"-Attribute programmatically?

asked 2012-11-05 12:32:19 +0800

CR13 gravatar image CR13
36 1

Hi all!

I'm new to zk and trying to add an Event to a programmatically created ListCell.

In a "CDATA-Block" of a *.zul-file I tried the following:

cell.setAttribute("onClick", "@command('showPreviewPopUp')");

I want the ListCell to react on the "showPreviewPopUp"-method of the model, which I have annotated with "@command", but i don't know, how to do this....
It would be very nice, if there is someone, who could help me....

Thnaks in advance!

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2012-11-05 16:49:19 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Hi,
my two cents: avoid using too much scripting, use classes, more maintainable.
Does ListCell support onClick?

link publish delete flag offensive edit

answered 2012-11-05 18:11:02 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Yes i do agree on avoiding scripts.

You can refer this article also
http://www.javacodegeeks.com/2012/01/zk-web-framework-thoughts.html

link publish delete flag offensive edit

answered 2012-11-05 18:36:50 +0800

zippy gravatar image zippy
504 1 2

Look this.

http://www.zkoss.org/forum/listComment/19405-change-order-in-listitem?lang=en

link publish delete flag offensive edit

answered 2012-11-06 06:41:42 +0800

CR13 gravatar image CR13
36 1

@all: Thank you!!!

I made it work with using the EventListener which reacts on "Events.On_Click".
There was no other possibility than solving it with script-blocks. its ugly but i don't know how to handle it in another way...

link publish delete flag offensive edit

answered 2012-11-06 12:36:05 +0800

CR13 gravatar image CR13
36 1

Hm. Now i ran into another problem:

with "attribute name="onCreate"> I created two Eventlisteners (Events.ON_CLick and Events.ON_DOUBLE_CLICK), but now the problem is, that a "DoubleClick" is always handled as two separate clicks, so the action under "ON_DOUBLE_CLICK - Event" will never be fired....

has someone a hint?

link publish delete flag offensive edit

answered 2012-11-06 22:35:02 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Why not post your code?


For me it seems you write about the listbox.
Take event:
onSelect instead of onClick
so the doubleClick would work.

best
Stephan

link publish delete flag offensive edit

answered 2012-11-07 11:32:03 +0800

CR13 gravatar image CR13
36 1

with "onSeelct" and "onDOubleClick" it works, BUT

only, if you really do a fast DoubleClick, else, both ("onSelect" AND "onDoubleClick") Events will be fired.

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: 2012-11-05 12:32:19 +0800

Seen: 141 times

Last updated: Nov 07 '12

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