ValueChangeListener not working with <selectOneMenu> containing a null value

1.8k views Asked by At

I've got a <selectOneMenu> with a list of objects, the first one is null (to allow "no selection" option), the problem is that when the "no selection" option is chosen, the valueChangeListener set in the is not fired.

I would like this to be able to clear a dataTable from it's content:

1) 1 object, not null, is selected -> display relevant data in the 2) the "no selection" option is selected, clear the table.

here is my code:

                <h:selectOneMenu id="flowSelectionFilter"
                    value="#{errorController.flowSelectionFilter}" onchange="submit()"
                    valueChangeListener="#{errorController.changeFlow}">
                    <f:selectItems
                        value="#{errorController.flowSelectionFilterValues}"
                        var="flowFilter" itemLabel="#{flowFilter}" />
                </h:selectOneMenu>

public String changeFlow(ValueChangeEvent event) throws Glossat2Exception {

    if (glossaryVersionSelectionFilter == null) {
        glossaryVersionSelectionFilter = new GlossaryVersionSelectionFilter(this.errorBean.getSelectedGlossaryVersion());
    }
    flowSelectionFilter = flowSelectionFilterMap.get(event.getNewValue());
    errorBean.setSelectedFlow(flowSelectionFilter.getFlowWithAction());
    return loadErrorsList(glossaryVersionSelectionFilter.getGlossaryVersion(), flowSelectionFilter.getFlowWithAction(), errorBean.getSelectedData());
}

the method is fired when any other object than null is selected.

thanks for your help

0

There are 0 answers