user2130951
user2130951

Reputation: 2741

ajax event not firing in JSF

I can't get the Ajax event to fire and call the actionListener or make the second select one update itself. What am I missing?

<p:selectOneMenu value="#{player}"
                converter="playerConverter" id="playerList">
            <f:selectItem itemLabel="---" noSelectionOption="true" />
            <f:selectItems value="#{servicePlayer.allPlayers}"
             var="n"
             itemValue="#{n}"
             itemLabel="#{n.combinedName}"
             itemLabelEscaped="true"/>
              <p:ajax event="change" execute="@this" actionListener="#
{serviceHCP.getClubs(player) }" update="ClubMenu" />
                </p:selectOneMenu>

                    <h:outputText value="Klubb"></h:outputText>
                    <!--  h:outputText value="#{ serviceHCP.myClubList.size()}" / -->

                    <p:selectOneMenu id="ClubMenu" value="#{serviceHCP.myCurrentClub}" rendered="#{not empty serviceHCP.myClubList}"
                    converter="clubConverter">
                        <f:selectItems value="#{serviceHCP.myClubList}"
                         var="clb"
                         itemValue="#{clb}"
                         itemLabel="#{clb.name}"
                         itemLabelEscaped="true"/>
                    </p:selectOneMenu>
                    <h:outputText value="Serietyp"></h:outputText>

Upvotes: 2

Views: 1893

Answers (1)

user2130951
user2130951

Reputation: 2741

Very stupid misstake

selectOneMenu ajax events

it's not called actionListener it's called listener.

wrong

<p:ajax event="change" execute="@this" actionListener="#{serviceHCP.getClubs(player) }" update="ClubMenu" />

correct

<p:ajax event="change" execute="@this" listener="#
{serviceHCP.getClubs(player) }" update="ClubMenu" />

Upvotes: 2

Related Questions