Hi
I have a selectOneMenu item which is used to select a credit rating agency ie:
<h:outputLabel value="Credit Rating Source:* " styleClass="default-label"/>
<p:selectOneMenu value="#{counterpartyBean.counterparty.ratingSource}" styleClass="default-input"
valueChangeListener="#{counterpartyBean.ratingSourceChanged}" update="creditRating">
<f:selectItem itemLabel="Not Specified" itemValue="NS"/>
<f:selectItem itemLabel="Fitch" itemValue="FT"/>
<f:selectItem itemLabel="Moodys" itemValue="MDY"/>
<f:selectItem itemLabel="Standard and Poors" itemValue="SP"/>
</p:selectOneMenu>
which I want to use to change the available values for credit ratings in another selectOneMenu ie:
<h:outputLabel value="CreditRating:* " styleClass="default-label"/>
<p:selectOneMenu id="creditRating" value="#{counterpartyBean.counterparty.creditRating}" styleClass="default-input"
valueChangeListener="#{counterpartyBean.creditRatingChanged}" update="pd">
<f:selectItems value="#{counterpartyBean.ratings}" />
</p:selectOneMenu>
This idea does not seem to work, any suggestions please
SelectOneMenu updating another attribute
Quick update, i have replaced the valueChangedListener to
<p:ajax listener="#{counterpartyBean.ratingSourceChanged}" />
as I am not interested in the old value and I do not want to submit the complete form at this stage, the ratingSourceChanged method is now getting called but the credit rating menu items are still not being updated
<p:ajax listener="#{counterpartyBean.ratingSourceChanged}" />
as I am not interested in the old value and I do not want to submit the complete form at this stage, the ratingSourceChanged method is now getting called but the credit rating menu items are still not being updated
Just to recap: I wanted a change to a p:selectOneMenu to update the list of values for anothe p:selectOneMenu immediately after a change to the first without waiting for the form to be submitted so finally cracked it:
So now, when the first selectOneMenu vakue changes, the list of ratings changes in the second and when that changes the pd value changes.
Code: Select all
<h:outputLabel value="Credit Rating Source:* " />
<p:selectOneMenu value="#{counterpartyBean.counterparty.ratingSource}" >
<f:selectItem itemLabel="Not Specified" itemValue="NS"/>
<f:selectItem itemLabel="Fitch" itemValue="FT"/>
<f:selectItem itemLabel="Moodys" itemValue="MDY"/>
<f:selectItem itemLabel="Standard and Poors" itemValue="SP"/>
<p:ajax listener="#{counterpartyBean.ratingSourceChanged}" update="creditRating"/>
</p:selectOneMenu>
<h:outputLabel value="CreditRating:* " />
<p:selectOneMenu id="creditRating" value="#{counterpartyBean.counterparty.creditRating}" >
<f:selectItems value="#{counterpartyBean.ratings}" />
<p:ajax listener="#{counterpartyBean.creditRatingChanged}" update="pd"/>
</p:selectOneMenu>
<h:outputLabel value="Probability of Default 0-100%: " />
<h:inputText id="pd" value="#{counterpartyBean.counterparty.pd}" size="8">
<f:convertNumber pattern="##0.0000"/>
</h:inputText>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 14 guests