-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
How do I to get event in view model to stop propagation ? like below code.
@Command @NotifyChange("model")
public void delete(Event event) {
event.stopPropagation();
Messagebox.show("Delete it ?", "confirm", Messagebox.YES|Messagebox.NO, Messagebox.QUESTION,
new EventListener(){
public void onEvent(Event e) throws Exception {
if(e.getName().equals("onYes")) {
System.out.println("Do change");
modellist.remove("Yes");
modellist.add("None");
}
}
});
}
public List<String> getModel(){
System.out.println("Changing...");
return modellist;
}
<window title="Hello World!!" border="normal" width="300px" height="200px"
apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('TestVM')">
<vlayout>
<button label="delete" onClick="@command('delete')"/>
<label value="@load(vm.model)"/>
</vlayout>
</window>
Thanx.
what about this :
@Command
@NotifyChange("model")
public void delete(@ContextParam(ContextType.TRIGGER_EVENT) Event event)) {
...
}
Greetz chill.
In stead of using the annotation @NotifyChange
use the BindUtils class.
You can put in code when you want to notify the binder.
example :
Messagebox.show("Delete it ?", "confirm", Messagebox.YES|Messagebox.NO, Messagebox.QUESTION, new EventListener(){
public void onEvent(Event e) throws Exception {
if(e.getName().equals("onYes")) {
System.out.println("Do change");
modellist.remove("Yes");
modellist.add("None");
BindUtils.postNotifyChange(null,null,modellist,"*");
}
}
});
Hello unitcell,
In a similar issue i changed the value of the disable-event-thread as shown in the following url:
http://books.zkoss.org/wiki/ZKConfigurationReference/zk.xml/Thesystem-configElement/Thedisable-event-threadElement
Best Regards,
Darksu
Asked: 2015-01-25 04:19:21 +0800
Seen: 23 times
Last updated: Jan 25 '15