-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
Is it possible to prevent a @NotifyChange event if the corresponding function fails?
Example:
@Command
@NotifyChange("status")
public void save() {
// write item to database fails
// question: what to do? throw exception? set flag?
}
Thank you for your help, Patrick
You can do like this
@Command
public void save() {
try{
//Write your business logic inside try block
//Last line will be
BindUtils.postNotifyChange(null, null, YourClassNameOrObject, "*");
}
catch(Exception e){
//If any line of code throw exception BindUtil will not call.And control comes here
{
}
}
Maybe we can use ValidationMessage. check these:
http://www.zkoss.org/javadoc/latest/zk/org/zkoss/bind/sys/ValidationMessages.html
http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM/Data_Binding/Validator
You can use BindUtils.postNotifyChange
Asked: 2012-09-13 08:04:53 +0800
Seen: 64 times
Last updated: Aug 01 '13