-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hello,
I'm trying to use ListModelList
in order to avoid NotifyChange
.
In my .zul page I have something like this:
<grid model="@load(vm.list) @template('row')">
<rows>
<template name="row">
<row>
<checkbox checked="@load(each.isModified)" />
</row>
</template>
</rows>
</grid>
And in my bean object i have a utility method that is like this:
public Boolean getIsModified() {
return "Y".equalsIgnoreCase(this.aString); // aString is a bean property that has getter and setter
}
Being an utility method, isModified
is not a bean property, it's just a simple method.
Whenever i change the aString
bean property however, the ListModelList
doesn't call this utility method to update the state of the checkbox. Is there a way (except using NotifyChange
) to make the ListModelList
call this utility method when the property aString
is changed?
Also, if i have to reload the data of a ListModelList
, why can't i use this?
ListModelList<Object> list = new ListModelList<Object>();
....
list = new ListModelList<Object>(collection);
Currently i'm using this instead, which is kinda ugly in my opinion..
ListModelList<Object> list = new ListModelList<Object>();
....
list.clear();
list.addAll(collection);
Thank you
2 | No.2 Revision |
Hello,
I'm trying to use ListModelList
in order to avoid NotifyChange
.
In my .zul page I have something like this:
<grid model="@load(vm.list) @template('row')">
<rows>
<template name="row">
<row>
<checkbox checked="@load(each.isModified)" />
</row>
</template>
</rows>
</grid>
And in my bean object i have a utility method that is like this:
public Boolean getIsModified() {
return "Y".equalsIgnoreCase(this.aString); // aString is a bean property that has getter and setter
}
Being an utility method, isModified
is not a bean property, it's just a simple method.
Whenever i change the aString
bean property however, the ListModelList
doesn't call this utility method to update the state of the checkbox. Is there a way (except using NotifyChange
) to make the ListModelList
call this utility method when the property aString
is changed?
Also, if i have to reload the data of a ListModelList
, why can't i use this?
ListModelList<Object> list = new ListModelList<Object>();
....
list = new ListModelList<Object>(collection);
Currently i'm using this instead, which is kinda ugly in my opinion..
ListModelList<Object> list = new ListModelList<Object>();
....
list.clear();
list.addAll(collection);
Thank you
EDIT:
I solved the first problem using list.notifyChange(item);
from java code when i update an item.
3 | No.3 Revision |
Hello,
I'm trying to use ListModelList
in order to avoid NotifyChange
.
In my .zul page I have something like this:
<grid model="@load(vm.list) @template('row')">
<rows>
<template name="row">
<row>
<checkbox checked="@load(each.isModified)" />
</row>
</template>
</rows>
</grid>
And in my bean object i have a utility method that is like this:
public Boolean getIsModified() {
return "Y".equalsIgnoreCase(this.aString); // aString is a bean property that has getter and setter
}
Being an utility method, isModified
is not a bean property, it's just a simple method.
Whenever i change the aString
bean property however, the ListModelList
doesn't call this utility method to update the state of the checkbox. Is there a way (except using NotifyChange
) to make the ListModelList
call this utility method when the property aString
is changed?
Also, if i have to reload the data of a ListModelList
, why can't i use this?
ListModelList<Object> list = new ListModelList<Object>();
....
ListModelList<Object>(); // initialization
....
@Command
public void updateCollection() {
list = new ListModelList<Object>(collection);
}
Currently i'm using this instead, which is kinda ugly in my opinion..
ListModelList<Object> list = new ListModelList<Object>();
....
ListModelList<Object>(); // initialization
....
@Command
public void updateCollection() {
list.clear();
list.addAll(collection);
}
Thank you
EDIT:
I solved the first problem using list.notifyChange(item);
from java code when i update an item.