0

setting onClick @command conditionally with attribute tag?

asked 2017-01-18 13:26:43 +0800

tisaksen gravatar image tisaksen
44 5

Hi

I'm trying to set the onClick handler of a Row conditionally as follows:

<row> <attribute name="onClick" if="${vm.condition == true}"> @command('setEditable', target=each) </attribute> <label value="test value"/> </row>

However, I'm getting the exception below and I'm guessing this is not supported with @command as value? If not, how can I request this as a feature?

org.zkoss.zk.ui.UiException: Sourced file: inline evaluation of: `` @command('setEditable', target=each);'' Token Parsing Error: Lexical error at line 21, column 2. Encountered: "c" (99), after : "@": <at unknown="" location="">

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_112]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_112]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_112]
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-18 13:57:23 +0800

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

perhaps just :

<button onClick="@command(vm.condition?'setEditable':'')" />

Chill.

link publish delete flag offensive edit

Comments

Ah, yes that's a good one, thanks!

tisaksen ( 2017-01-19 07:47:02 +0800 )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: 2017-01-18 13:26:43 +0800

Seen: 23 times

Last updated: Jan 18 '17

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