Hello!
For the entity, I define the enum property as a string, according to the documentation on the site (String with typed getter/settter):
docs
I use a KeyValueCollection with this enum property but define it with datatype=“string” otherwise it will throw an error:
ClassCastException: class java.lang.String cannot be cast to class java.lang.Enum (java.lang.String and java.lang.Enum...
I also have various filters, including for this enum property. Since it is defined as a string, I use a custom filter:
@Subscribe
public void onStateFilterValueChange(HasValue.ValueChangeEvent<PetState> event) {
if (event.getValue() != null) {
petDl.setParameter("state", event.getValue().getId());
} else {
petDl.removeParameter("state");
}
petDl.load();
}
The problem is with the ? in paginator. I get an error when I try to count the total number of rows:
RuntimeException: Unable to find selected entity name
It would be possible to use totalCountDelegate, but due to the presence of custom filters, each condition in the where block will have to be processed manually (in a real example, there are several of them).
<keyValueCollection id="petDc" >
<loader id="petDl" >
<query>
<![CDATA[select p.state, ... from Pet p, PetOwner po
left join p.vaccine v]]>
<condition>
<and>
<c:jpql>
...
<c:where>p.state = :state</c:where>
...
</c:jpql>
</and>
</condition>
</query>
</loader>
<properties>
...
<property name="state" datatype="string" />
...
</properties>
</keyValueCollection>
</data>
<layout>
<vbox spacing="true">
<hbox spacing="true">
<label value="Pet state" width="150" align="MIDDLE_LEFT" />
<comboBox id="stateFilter"
optionsEnum="...entity.pet.PetSTate" />
</hbox>-->
<table id="petInfoTable"
width="100%"
dataContainer="petDc">
<columns>
<column id="state" caption="Pet state" />
</columns>
<simplePagination id="petPagination" itemsPerPageDefaultValue="20"/>
</table>
</vbox>
</layout>
Am I using the wrong approach or is this a bug?