Search code examples
javazk

@NotifyChange doesn't work


So in my ZUL I have :

<label value="Montant HT" />
<textbox id="totalSoldDF" readonly="true" style="text-align: center"
                    value="@load(c:formatNumber(vm.totalSoldDF, '#,###.##€'))" />

and I'm trying to update this field like this :

@NotifyChange({"totalSoldDF"})
public void countTotalSold() {

    totalSoldDF = 0;
    for (Profile p : profileList) {
        totalSoldDF += pen.getTotal();
    }
}

But nothing happens and I'm sure that the variable is changing.


Solution

  • @NotifyChange do work, but you need to use it correct.
    The annotation can only be set on setters and on commands as described in the documentation.

    Now, don't worry, there is another method what you can do :

    BindUtils.postNotifyChange(null,null,this,"totalSoldDF");