-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, i got method which delete item from list. In 1st case, without Messagebox everything works perfectly...
@Command
@NotifyChange ({"relaisList"})
public void deleteRelay(@BindingParam("relay") SicherungenRelais9X1Wrm myRelay)
{
sicherungenRelais9X1WrmManager.delete(relayToDelete);
relaisList=sicherungenRelais9X1WrmManager.getAll();
}
In the second one (with Messagebox to confirm item deletion) item is deleted from my DB, but itemlist is not updated...
@Command
@NotifyChange ({"relaisList"})
public void deleteRelay(@BindingParam("relay") SicherungenRelais9X1Wrm myRelay)
{
relayToDelete=myRelay;
Messagebox.show("Are you sure?", "Delete?", Messagebox.YES|Messagebox.NO,
Messagebox.QUESTION,
new EventListener() {
public void onEvent(Event evt) {
if ("onYes".equals(evt.getName())) {
sicherungenRelais9X1WrmManager.delete(relayToDelete);
relaisList=sicherungenRelais9X1WrmManager.getAll();
}
}
}
);
}
Thx in advance for help.
you try it:
@NotifyChange ({"relaisList"})
@Command
public void deleteRelay(@BindingParam("relay") SicherungenRelais9X1Wrm myRelay)
{
relayToDelete=myRelay;
Messagebox.show("Are you sure?", "Delete?", Messagebox.YES|Messagebox.NO,
Messagebox.QUESTION,
new EventListener() {
public void onEvent(Event evt) {
if ("onYes".equals(evt.getName())) {
sicherungenRelais9X1WrmManager.delete(relayToDelete);
relaisList=sicherungenRelais9X1WrmManager.getAll();
BindUtils.postNotifyChange(null, null, ViewModelClass.this, "relaisList");// here notify your list
}
}
}
);
}
How about
@Command
@NotifyChange ({"relaisList"})
public void deleteRelay(@BindingParam("relay") SicherungenRelais9X1Wrm myRelay)
{
relayToDelete=myRelay;
int result = Messagebox.show("Are you sure?", "Delete?", Messagebox.YES|Messagebox.NO,
Messagebox.QUESTION,
new EventListener() {
public void onEvent(Event evt) {
if ("onYes".equals(evt.getName())) {
sicherungenRelais9X1WrmManager.delete(relayToDelete);
}
}
}
);
// Only update UI when delete
if(result == Messagebox.YES) {
relaisList=sicherungenRelais9X1WrmManager.getAll();
}
}
There are a thread talking about the same issue and they have another workaround approach with global command
Asked: 2014-01-27 15:40:30 +0800
Seen: 31 times
Last updated: Jan 27 '14
MVVM Notifychange works only along with @Command ?
Upload csv files with Zk framework
MVVM Notifychange for bean property not working ?
Create notification icon with zk 7 CE
@NotifyChange not refresh textbox
how can i get data from another page
Notify Form of property change
ZK Listbox Can we Notify only Single Column Value?