I have a datatable with a single selection. After selection of a row and pressing button, dialog with input texts and select one menus will open. Input texts and one menus should contain data of selected row. In general, it is a dialog for editing records in datatable.
But select one menus in dialog will not change default value based on selected row. It is working with <h:selectOneMenu>
but not with extended from Primefaces <p:selectOneMenu>
. What I am doing wrong?
I am using Primefaces 5.0 and JSF 2.1.
XHTML:
<h:form id="form">
<p:dataTable
id="datatable"
var="spec"
value="#{selectionRowAction.specimensBO.list}"
selection="#{selectionRowAction.selectedSpecimen}"
selectionMode="single"
rowKey="#{spec.id}"
resizableColumns="true">
<f:facet name="header">
<p:commandButton id="editButton"
process="datatable"
update=":form:editPanel"
icon="ui-icon-pencil"
oncomplete="PF('dlg').show()"/>
</f:facet>
<p:column headerText="ID" >
<h:outputText value="#{spec.subjectIdNumber}" />
</p:column>
<p:column headerText="Type" >
<h:outputText value="#{spec.specimenType.displayText}" />
</p:column>
</p:dataTable>
<p:dialog widgetVar="dlg" >
<p:outputPanel id="editPanel" >
<p:panelGrid columns="2">
<h:outputText value="ID: "/>
<p:inputText
value="#{selectionRowAction.selectedSpecimen.subjectIdNumber}"/>
<h:outputText value="Type: " />
<p:selectOneMenu
value="#{selectionRowAction.selectedSpecimen.specimenType}"
converter="#{specimenTypeConverter}">
<f:selectItem itemLabel="Select One"/>
<f:selectItems value="#{basicSelectionsBO.specimenTypes}"
var="type"
itemLabel="#{type.displayText}"
itemValue="#{type}"/>
</p:selectOneMenu>
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>