Unable to set a default value on a list with combo box using <p:selectOneMenu

UI Components for JSF
Post Reply
ramkrish
Posts: 1
Joined: 17 Jun 2021, 12:37

17 Jun 2021, 12:52

I am trying to set a default value on a list using <p:selectOneMenu. But the list in the UI does not set the value passed from the bean.
My list type is a combo box. Value is stored in a custom object called product which is a combination of 2 Strings. Can someone please share any insights on how to achieve this?

<td>
<p:selectOneMenu id="div_products" value="#{newPart.product}" panelStyle="width:180px" effect="fade" var="prd" forceSelection="true" autoWidth="true" filter="true" filterMatchMode="contains" converter="prodConverter" disabled="#{newPart.tcNumberFlag}">
<f:selectItem itemLabel="#{newPart.product}" itemValue="" />
<f:selectItems value="#{newPart.products}" var="prod" itemLabel="#{prod.product}" itemValue="#{prod}" />
<p:column style="width:10%">
<h:outputText value="#{prd.product}" />
</p:column>
<p:column>
<h:outputText value="#{prd.prodDesc}" />
</p:column>
<p:ajax event="itemSelect" listener="#{newPart.onChange()}" update="div_systemNumber checkParts msgs actionPanel" />
</p:selectOneMenu>
</td>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests