-
1. Re: Selection problem with rich:comboBox in 3.3.3
nbelaevski Dec 20, 2010 6:31 PM (in response to vivek_madapura)Hi Vivek,
Can you please post bean/page code?
-
2. Re: Selection problem with rich:comboBox in 3.3.3
vivek_madapura Dec 21, 2010 5:08 AM (in response to nbelaevski)Hi Nick,
The contents of the xhtml page
<h:outputText value="EA - Name" style="padding-left:10px"></h:outputText>
<rich:comboBox id="eaNameSelect" width="325px"
defaultLabel="EA Name" style="padding-left:10px;"
suggestionValues="#{dataTableBean.eaList}"
value="#{dataTableBean.selectEa}"
valueChangeListener="#{dataTableBean.updateSelectedEA}">
<a4j:support event="onselect" ajaxSingle="true"
reRender="eaNumberSelect,comparisonTable" requestDelay="50"
onsubmit="#{rich:component('panel')}.show()"
oncomplete="#{rich:component('panel')}.hide()" />
<f:converter converterId="eaComboConverter" />
</rich:comboBox><h:outputText value="EA - Number" style="padding-left:10px">
</h:outputText><rich:comboBox id="eaNumberSelect" selectFirstOnUpdate="false"
defaultLabel="EA Number" style="padding-left:10px;"
suggestionValues="#{dataTableBean.eaList}"
value="#{dataTableBean.selectEa}"
valueChangeListener="#{dataTableBean.updateSelectedEA}">
<a4j:support event="onselect" ajaxSingle="true"
reRender="eaNameSelect,comparisonTable" requestDelay="50"
onsubmit="#{rich:component('panel')}.show()"
oncomplete="#{rich:component('panel')}.hide()" />
<f:converter converterId="eaComboConverter" />
</rich:comboBox>These two combo boxes use the same converter because the object behind them are same.
The contents of the converter
public Object getAsObject(FacesContext context, UIComponent component,
String value) {
@SuppressWarnings("unchecked")
List<Ea> eaList = (List<Ea>) component.getAttributes().get(
"suggestionValues");
Ea returnValue = null;
System.out.println("in getAsObject " + component.getId());
Iterator<Ea> iterator = eaList.iterator();
while (iterator.hasNext()) {
Ea ea = (Ea) iterator.next();
if (ea.getName().equalsIgnoreCase(value)
|| ea.getNumber().equalsIgnoreCase(value)) { // the number is a string here
returnValue = ea;
break;
}}
System.out.println("THe input value is " + value); // this prints empty
System.out.println("the return value is " + returnValue); // and hence this is null
return returnValue;}
public String getAsString(FacesContext context, UIComponent component,
Object object) {
String returnValue = "";
if (null != object) {
Ea ea = (Ea) object;
if (component.getId().equalsIgnoreCase("eaNameSelect"))
returnValue = ea.getName();
else if (component.getId().equalsIgnoreCase("eaNumberSelect"))
returnValue = ea.getNumber();
}
return returnValue;}
The contents of the bean :
/**
* The selected ea from either of the combo boxes
*/
private Ea selectEa = null;/**
* @param event
*/
public void updateSelectedEA(ValueChangeEvent event) {
Ea ea = (Ea) event.getNewValue();
selectEa = ea;
}/**
* @return the selectEa
*/
public Ea getSelectEa() {
return selectEa;
}/**
* @param selectEa
* the selectEa to set
*/
public void setSelectEa(Ea selectEa) {
this.selectEa = selectEa;
}One correction from the post above - the richfaces jars i have used is of version 3.3.3
-
3. Re: Selection problem with rich:comboBox in 3.3.3
vivek_madapura Dec 24, 2010 3:30 AM (in response to vivek_madapura)Hi,
Any inputs on this is much appreciated.
-Vivek Madapura