-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I have an Arraylist of 20 objects to view in a grid. For each row I have a combobox. The visibility of another field depends from the combobox's value. This is my zul code:
<cell>
<combobox width="100%" model="@load(vm.codSistProvDomain.domainList)" value="@bind(item.codSistProv) @converter(vm.codSistProvDomain)" readonly="true"
onSelect="@command('updateVersion', index=i.index)">
<template name="model" var="tt">
<comboitem label="@load(tt.description) " value="@load(tt.code)" height="20px" />
</template>
</combobox>
</cell>
<cell>
<intbox constraint="no negative,no zero" width="100%" value="@bind(item.codContractVersion)" disabled="@load(item.isVersionDisabled())" />
</cell>
To change dinamically the disable property of the intbox, I want to use the postNotifyChange statement. So I have this code:
@Command
public void updateVersion(@BindingParam("index") int index) {
BindUtils.postNotifyChange(null, null, dataListModel.getDataList().get(index), "isVersionDisabled");
}
where isVersionDisabled is a method of the object of my arraylist. This is the code:
public boolean isVersionDisabled() {
if (codSistProv != null && codSistProv.equalsIgnoreCase("MX90"))
return false;
return true;
}
So, if I use this code, this works correctly only the first time, on the first element of the grid. In all other cases this approch doesn't work. Do you have some idea about the reason? Can you help me to solve my problem?
Thanks
Asked: 2016-07-13 13:36:52 +0800
Seen: 18 times
Last updated: Jul 13 '16
Hello hancock46,
Can you try
@NotifyChange("*")
with the Command?http://books.zkoss.org/zk-mvvm-book/8.0/viewmodel/notification.html
Best Regards,
Darksu
Darksu ( 2016-07-13 22:01:31 +0800 )editYes, in this way it works but it is more slow. I won't update all variables but only a field of an object of an arraylist.
hancock46 ( 2016-07-14 07:11:32 +0800 )editany reason why you put a function into the expression "@load(item.isVersionDisabled())" instead of just using the property name "@load(item.versionDisabled)". I remember there was a bug on using function names instead of property names in expressions. I can't tell without the exact version.
cor3000 ( 2016-09-21 01:00:00 +0800 )edit