0

my selectonemenu does neither call the setter nor the getter after chosing an option. The map is displayed correctly in the dropdown.

Here is my code:

      <p:selectOneMenu id="filter" value="#{myPatientsBean.selectedFilter}"
        valueChangeListener="#{myPatientsBean.activateDefaultFilter}">
        <f:selectItems value="#{myPatientsBean.defaultFilterEntries.entrySet()}" var="map" itemValue="#{map.value}" itemLabel="#{map.key}"/>
        <p:ajax update="patientdata" event="change" />
      </p:selectOneMenu>

and here is the backing Bean:

    public Map<String, String> getDefaultFilterEntries() {
        return getPatientForFilter().getDefaultFilterEntries(getCurrentUser().hasRight(UserRight.PATIENTVIEWALL));
    }


    public void setSelectedFilter(String index) {
        selectedFilter = Integer.parseInt(index);
        if (selectedFilter == -1) {
            setUseDefaultFilter(false);
        }
    }

    public String getSelectedFilterString() {
        return Integer.toString(selectedFilter);
    }

the ValueChangeListener is called too..

Would be very grateful for help. Tried almost everything :( A list doesn't solve my Problem neither.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Lule
  • 68
  • 9

2 Answers2

0

Just remove the valueListener and replace ajax tag as below

<p:ajax listener=#{myPatientsBean.activateDefaultFilter}" update="patientdata" />
Ali Helmy
  • 784
  • 6
  • 18
0

that was not the Problem. I got the solution. I just got confused with the types of getter and setter... I just had an integer Setter but needed one for a String. The rest of the code is correct.

ty at all

Lule
  • 68
  • 9