I would like to put input fields inside a datatable. The datatable is bound to an PersonLevel entity list. The input fields use rich:suggestionbox and when a value is selected it should return a Level entity that will be bound to the PersonLevel.level property. That's how it should work in theory, but it doesn't (type mismatch error). If I don't put in the a4j:support for selecting the suggestionbox it overwrites the Level.name property which is not the desired behaviour. What is the proper way of implementing this?
<rich:dataTable var="_personLevel" value="#{personHome.personLevelsList}">
<rich:column>
<h:inputText id="levelInput" value="#{_personLevel.level.name}"/>
<h:graphicImage value="/img/dropdown.png" onclick="#{rich:component('levelSuggestion')}.callSuggestion(true)"/>
<rich:suggestionbox id="levelSuggestion" for="levelInput" fetchValue="#{_level.name}"
var="_level" suggestionAction="#{levelLookup.lookup}">
<a4j:support event="onselect">
<f:setPropertyActionListener target="#{_personLevel.level}" value="_level"/>
</a4j:support>
<h:column>
<h:outputText value="#{_level.name}"/>
</h:column>
</rich:suggestionbox>
</rich:column>
</rich:dataTable> @Entity
public class PersonLevel {
private int id;
private Level level;
...
}
@Entity
public class Level {
private int level;
private String name;
}