-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Maybe i don't know how to do it but it seems strange to me. I have, lets say, a textbox with the following binding:
<textbox value"@load(vm.store.shoppingCart.itemsCount)" />
As soon as i open the page everything works fine and the textbox displays the correct number of items in the cart. Now, if i modify the ShoppingCart's contents the @NotifyChange does not reflect the changes back to the page:
@Command("add-item")
@NotifyChange("store.shoppingCart.itemsCount")
public void addItem(Item item) {
store.shoppingCart.addItem(item);
}
What am i doing wrong? The only solution i found was to add the 'dummy' getter getCartItemsCount() directly into the ViewModel and bind the textbox to this getter:
value="@load(vm.getCartItemsCount)"
Another way is to make a @NotifyChange(".") but this is to 'heavy' for my page. Is there any other way so that the @NotifyChange mechanism can resolve the properties path?
[ZK ver 6.5.2]
Thank you all /costas
Currently VM will not "Chain" the getters,
the code
@NotifyChange("store.shoppingCart.itemsCount")
probably mapped to
public ??? getStore.shoppingCart.itemsCount () // just guess, not sure
change the NotifyChange as below then it should work:
@NotifyChange("store") // vm.getStore()
Acc. to my understanding,itemscount is a variable in your shoppingCart bean object.you are calling some method to add a item,that doesn't change the itemscount. You have to elaborate a more for better understanding.still try using:-
BindUtils.postNotifyChange(null, null, this.store.shoppingCart, "*");
inside add item method.
Asked: 2013-06-26 15:00:12 +0800
Seen: 84 times
Last updated: Jun 28 '13
I had the same problem. But just to close, i used @NotifyChange(".") .
Senthilchettyin ( 2013-06-26 15:18:30 +0800 )edit@benbai Yes. @NotifyChange("store") worked..
thanks a lot
/costas
cyiannoulis ( 2013-06-28 13:02:18 +0800 )edit