JSF 2 + Primefaces - Update tag Not Working

Viewed 115

ajax update is not working when click on selectOneMenu and change the faculty when I reload the page it make the update
I have searched for an hours but cannot find any solution the method onChooseFaculty runs fine but the update is not

<h:form id="home">
    <p:sidebar id="homeSider" widgetVar="sidebar1">
        <h2 style="font-weight: normal">Select Department</h2>
        <br></br>
        <h:panelGrid id="homePanel" columns="2" cellpadding="5">
            <p:outputLabel for="faculty" value="Faculty: " />
            <p:selectOneMenu id="faculty" value="#{homeBacking.selectdFaculty}"
                style=" width:12em">
                <p:ajax listener="#{homeBacking.onChooseFaculty}"
                    ignoreAutoUpdate="false" update=":home:department" />

                <f:selectItem itemLabel="Select Faculty" itemValue=""
                    noSelectionOption="true" />
                <f:selectItems value="#{homeBacking.faculty}" />
            </p:selectOneMenu>

            <p:outputLabel for="department" value="Department: " />
            <p:selectOneMenu id="department"
                value="#{homeBacking.selectedDepartment}" style="width:12em"
                disabled="#{homeBacking.enableDept}">
                <f:selectItem itemLabel="Select Department" itemValue=""
                    noSelectionOption="true" />
                <f:selectItems value="#{homeBacking.department}" />
            </p:selectOneMenu>
        </h:panelGrid>
        <p:separator />
        <div class="container " align="center">
            <p:commandButton value="Submit" update="" />
            <p:commandButton value="Cancel" oncomplete="PF('sidebar1').hide()" />
        </div>
    </p:sidebar>
</h:form>

I tried:

update=":home:homeS:homePanel:department" 
update=":home:homeS:department" 
update=":home:department" 
update=":department" 
update=":home"
update=":sidebar"

add panelgroup and update it and a lot of other things

what's going on?! Thanks for any help.

1 Answers

I see you're specifying some ID called "home". I can not see any element with this ID.

But since "faculty" and "department" are in the same naming container it should be sufficient to just write update="department".

Related