-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I'm new to zk and today i tried making some custom components, like i was doing in jsf before.
I made a custom button and it renders ok but i want to change the command on the onClick event. I have read some examples on how to change onclick event dynamically in java but since the button does not have its own view model i was thinking if it is possible to change it by passing it as a component argument.
This is my code:
component:
<zk>
<div>
<label value="${arg.command}" />
<button label="Test" onClick="${arg.command}" /><!-- is there a way to pass the command here??? -->
</div>
</zk>
home.zul
<?component name="testMacro" macro-uri="/custom/myMacro.zul" command="@command('test')"?>
<zk>
</zk>
Thanks for the help and excuse the dumb noob question :D
here an example using your macro and passing in the commandName as a argument: http://zkfiddle.org/sample/2bfu6qc/1-macro-with-command-param.
Robert
Asked: 2015-01-16 14:34:16 +0800
Seen: 29 times
Last updated: Jan 19 '15
Problem binding values to a composite component
How to access static member field of a class in zul without zscript
How can i load a constant in .zul
MVVM Validator: class not found ? [closed]
MVVM tab box - delay @load until tab pane displayed?
mvvm, load or save with after or before for seach command
how to fire an event when a variable value loaded through VM
is there any event trigger from zk component on binding ?
ZK team plans to dispose of Composer EventQueues no longer in scope? [closed]
maybe make your own implementation of the button, (extends Button) then you could set an custom-attribute to the button, witch you collect in MyButton class? (just quick thinking)
chillworld ( 2015-01-16 15:04:42 +0800 )edit