-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have a ZUL page with some labels:
<label id="myID" onClick='addFacet("structure", self.id)'>Something</label>
where "addFacet" in the onClick event is a z script:
<zscript>
void addFacet(type, s){
.....
Now, during runtime, I need to add some more labels with exactly the same onCLick event. Is it possible to do that from Java? I read about adding an event listener, but how can I call z script from there?
Thanks a lot!
Zscript is indeed by default Java.
Look at this example of cor3000(JavaScript) : http://zkfiddle.org/sample/1vkkv0d/2-Bind-custom-event-to-command-in-MVVM#source-2
He execute a zscript function from Java. The only thing what you need to do is add an eventListener to your labels who listens to the onClick event.
If the zscript is Java, put it in a Java class.
zscript is for prototyping and everything what's inside zscript can be translated to Java classes.
If the method can be made static and you want also to acces it from the zul you can use xel-method.
Greetz chill.
Asked: 2015-05-18 09:50:19 +0800
Seen: 27 times
Last updated: May 18 '15
did you try with
chillworld ( 2015-05-18 11:02:37 +0800 )editClients.evaljavascript()
?