-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
i got problem with @NotifyChange on single item from itemlist. My app is showing items (kundes) from database, next to each item i have button to activate/deactivate item. My problem is with synchronizing...f.e. when i click on activate it will change active attribute to "true" (this works well), the problem is that after I click on "activate" on the screen of my app button "activate" should switch into "deactivate", but it doesn't.
Any help would be appreciated. Thx.
pic of my app: http ://oi40.tinypic.com/f27rza.jpg
part of zul file:
<listitem>
<listcell label="@load(each.id)"/>
<listcell label="@bind(each.number)"/>
<listcell label="@bind(each.name)"/>
<listcell>
<button label="Deactivate" if="${each.getAktiv()}" disabled="${not each.getAktiv()}" onClick="@command('deactivateKunde', kunde=each)" />
<button label="Activate" if="${not each.getAktiv()}" disabled="${each.getAktiv()}" onClick="@command('activateKunde', kunde=each)" />
</listcell>
</listitem>
viewmodel file:
@Command
@NotifyChange({"kundeList","selectedKunde"})
public void activateKunde(@BindingParam("kunde") Kunde myKunde) {
kundeService.activateKunde(myKunde, bindCheckBox);
}
@Command
@NotifyChange({"kundeList","selectedKunde"})
public void deactivateKunde(@BindingParam("kunde") Kunde myKunde) {
kundeService.deactivateKunde(myKunde, bindCheckBox);
}
Why are calling like this each.getAktiv() call variable rather than getmethod ,If you will call varaible it automatically call get Method.Second where you updated the value of aktiv varaible so it will notifychange
Asked: 2013-06-10 10:09:10 +0800
Seen: 7 times
Last updated: Jun 10 '13
1st if i understand you, i should use it like this? <button label="Deactivate" if="${each.aktiv}" disabled="${not each.aktiv}" onClick="@command('deactivateKunde', kunde=each)" />
demizon ( 2013-06-10 11:09:40 +0800 )edit2nd ok I just figured out how to solve it by adding myKunde.setAktiv(false); and myKunde.setAktiv(true);
demizon ( 2013-06-10 11:13:23 +0800 )editsjoshi, by your questions u showed me answers thx :) you can close this
demizon ( 2013-06-10 11:18:35 +0800 )editYou can accept answer and we will close it
sjoshi ( 2013-06-10 12:03:18 +0800 )edit