1

@NotifyChange on item from itemList [closed]

asked 2013-06-10 10:09:10 +0800

demizon gravatar image demizon
179 1 6

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);
    }
delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by sjoshi
close date 2013-06-10 14:03:20

Comments

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 )edit

2nd 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 )edit

sjoshi, by your questions u showed me answers thx :) you can close this

demizon ( 2013-06-10 11:18:35 +0800 )edit

You can accept answer and we will close it

sjoshi ( 2013-06-10 12:03:18 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-06-10 10:17:34 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

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

link publish delete flag offensive edit

Question tools

Follow

RSS

Stats

Asked: 2013-06-10 10:09:10 +0800

Seen: 7 times

Last updated: Jun 10 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More