I am trying to show the details of 'SelectItem' object of SelectOneListBox
on a set of Input fields. Problem that I am facing is, whenever the page is
rendered partially, it always returns the 'value' of SelectOneListBox as
null. I have tried using both 'change' and 'click' facets, and both of them
are not giving the desired results.
Here's the scenario, in little detail:
When I use, 'click' facet, and tried to select different list items:
** In the valueChangeEvent, everytime it's retaining the initially set value
(First item of List box, which I set when I render the panel for the first
time) .
** getValue() of the source component in the valueChange event, is
supposedly returning the binding value, if the current value is null. And, I
guess, this is the reason, it retains the old value, if the current
localvalue is null.
** After this listerner call, it tries to set the value of the
SelectOneListBox's bound value as null, and this results in NPException, as
the 'DetailPanel's fields are this object's properties.
** I tried intercepting with a Validator - Surprisingly, this is not called
at all...
When I use "Change" facet and tried to select different list items:
** ValueChangeEvent does not occur at all
**Agreeably, 'change' facet's command is also not called
**No validator call is made
Here's the code snippet:
*<tc:panel id="orderPanel">
....
...
<tc:box label="#{rsrcBundle.order_orderListLabel}">
<f:facet name="layout">
<tc:gridLayout rows="*" columns="*" margin="2px" />
</f:facet>
<tc:selectOneListbox value="#{orderPanelController.order}"
valueChangeListener="#{orderPanelController.showInDetail}"
validator="#{orderPanelController.validateListSelection}">
<f:selectItems value="#{orderPanelController.orders}" />
<f:converter converterId="deviceOrderId" />
<f:facet name="click">
<tc:command action="#{orderPanelController.returnNull}">
<tc:attribute value=":cdbmainpage:orderPanel"
name="renderedPartially" />
</tc:command>
</f:facet>
<%-- I tired the same command with 'change' facet' also %>
</tc:selectOneListbox>
</tc:box>
<tc:panel id="orderDetailPanel">*
....
..
OrderPanelController:
*public void showInDetail(ValueChangeEvent valChangeEvent) {
UISelectOne select = (UISelectOne)valChangeEvent.getComponent();
if(select.getValue() == null){
LOG.finer("Value is null");
return;
}
order = (DeviceOrder) select.getValue();
LOG.finer("Selected Order: "+select.getValue());
return;
}
public void validateListSelection(FacesContext context, UIComponent
component, Object value) throws ValidatorException {
if (value == null) {
System.out.println("List validation:Came here : Value is null");
return;
}
order = (DeviceOrder) value;
LOG.finer("Selected order in validation: "+order);
}
*
Appreciate your help!*
*--
Thanks,
Raj .G. Narasimhan