p:dataTable is not updating

时间:2015-10-06 09:01:58

标签: jsf primefaces

I have the following code in a xhtml file. After clicking the command button to save, it doesn't:

<p:tab id="bookingTab" title="Booking Information">

    <p:panelGrid id="bookingGrid" columns="4">
        <f:facet name="header">
            #{bundle.CreateOrdrBookingTitle}
        </f:facet>
        <h:outputLabel value="#{bundle.CreateOrdrBookingLabel_number}"
            for="number" />
        <p:inputText id="number" value="#{ordrBookingController.selected.number}"
            title="#{bundle.CreateOrdrBookingTitle_number}" required="true"
            requiredMessage="Please enter Booking Number" />
        <h:outputLabel value="#{bundle.CreateOrdrBookingLabel_ponumber}"
            for="ponumber" />
        <p:inputText id="ponumber"
            value="#{ordrBookingController.selected.ponumber}" title="#{bundle.CreateOrdrBookingTitle_ponumber}"
            required="true" requiredMessage="Please enter Booking PO Number" />
        <h:outputLabel value="#{bundle.CreateOrdrBookingLabel_bookingDate}"
            for="date" />


        <p:calendar id="bookingDate" readonlyInput="true"
            pattern="dd/MM/yyyy HH:mm:ss" value="#{ordrBookingController.selected.bookingDate}"
            title="#{ordrBookingController.selected.bookingDate}" required="true"
            requiredMessage="Please enter Booking Date">
            <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
        </p:calendar>
        <h:outputLabel value="#{bundle.CreateOrdrBookingLabel_cost}"
            for="cost" />
        <p:inputText id="cost" value="#{ordrBookingController.selected.cost}"
            title="#{bundle.CreateOrdrBookingTitle_cost}" required="true"
            requiredMessage="Please enter Booking Cost" />


        <h:outputLabel value="Contact Person" for="contactname" />
        <p:inputText id="contactname"
            value="#{ordrBookingController.selected.contactName}" title="Contact Name"
            required="true" requiredMessage="Please enter Contact Name" />

        <h:outputLabel value="Contact Number" for="contactnumber" />
        <p:inputText id="contactnumber"
            value="#{ordrBookingController.selected.contactNumber}" title="Contact Number"
            required="true" requiredMessage="Please enter Contact Number" />

        <h:outputLabel value="Comment" for="comment" />
        <p:inputTextarea id="comment"
            value="#{ordrBookingController.selected.comment}" title="Comment"
            required="true" requiredMessage="Please enter a comment" />
        <h:outputLabel value="Email List" />
        <p:selectCheckboxMenu value="#{ordrBookingController.selectedUsrs}"
            id="emailList" label="Select Users to Email" filter="true"
            filterMatchMode="startsWith" panelStyle="width:420px" required="true"
            requiredMessage="Please supply users that need to be emailed">
            <f:selectItems value="#{usrController.itemsAvailableSelectManyEmail}" />
        </p:selectCheckboxMenu>
        <f:facet name="footer">
            <p:commandButton action="#{ordrBookingController.create}"
                process="bookingGrid" value="#{bundle.CreateOrdrBookingSaveLink}"
                icon="ui-icon-check" ajax="true" immediate="false"
                update="bookingTable bookingGrid :bookingForm:messagePanel">
                <f:setPropertyActionListener
                    target="#{ordrBookingController.selected.ordr}" value="#{ordrController.selected}" />
                <f:setPropertyActionListener
                    target="#{ordrBookingController.selected.active}" value="#{true}" />
            </p:commandButton>
        </f:facet>
    </p:panelGrid>


    <br></br>
    <p:dataTable id="bookingTable"
        value="#{ordrController.selected.ordrBookingList}" var="bookingItem"
        rowKey="#{bookingItem.id}" paginator="true" rows="10"
        filteredValue="#{ordrBookingController.filteredItems}">
        <f:facet name="header">
            #{bundle.ListOrdrBookingTitle}
        </f:facet>
        <p:column headerText="#{bundle.ListOrdrBookingTitle_id}"
            sortBy="#{bookingItem.id}">
            #{bookingItem.id}
        </p:column>
        <p:column headerText="#{bundle.ListOrdrBookingTitle_number}"
            sortBy="#{bookingItem.number}">
            #{bookingItem.number}
        </p:column>
        <p:column headerText="#{bundle.ListOrdrBookingTitle_ponumber}"
            sortBy="#{bookingItem.ponumber}">
            #{bookingItem.ponumber}
        </p:column>
        <p:column headerText="#{bundle.ListOrdrBookingTitle_bookingDate}"
            sortBy="#{bookingItem.bookingDate}">
            <h:outputText value="#{bookingItem.bookingDate}">
                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
            </h:outputText>
        </p:column>
        <p:column headerText="#{bundle.ListOrdrBookingTitle_cost}"
            sortBy="#{bookingItem.cost}">
            R
            <h:outputText value="#{bookingItem.cost}">
                <f:convertNumber pattern="#0.00" />
            </h:outputText>
        </p:column>
        <p:column headerText="Contact" sortBy="#{bookingItem.ponumber}">
            #{bookingItem.contactName}
        </p:column>

        <p:column headerText="Contact Number" sortBy="#{bookingItem.contactNumber}">
            #{bookingItem.contactNumber}
        </p:column>

        <p:column headerText="Comment" sortBy="#{bookingItem.comment}">
            #{bookingItem.comment}
        </p:column>
        <p:column headerText="User" sortBy="#{bookingItem.createUsr}"
            rendered="#{bookingItem.createDate == bookingItem.updateDate}">
            #{bookingItem.createUsr}
        </p:column>


        <p:column headerText="Created Date" sortBy="#{bookingItem.createDate}"
            rendered="#{bookingItem.createDate == bookingItem.updateDate}">
            <h:outputText value="#{bookingItem.createDate}">
                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
            </h:outputText>
        </p:column>
        <p:column headerText="User" sortBy="#{bookingItem.updateUsr}"
            rendered="#{bookingItem.createDate != bookingItem.updateDate}">
            #{bookingItem.updateUsr}
        </p:column>

        <p:column headerText="Update Date" sortBy="#{bookingItem.updateDate}"
            rendered="#{bookingItem.createDate != bookingItem.updateDate}">
            <h:outputText value="#{bookingItem.updateDate}">
                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
            </h:outputText>
        </p:column>
        <p:column>
            <p:commandButton value="Edit" process="@this" ajax="true"
                update=":bookingForm:tabView:bookingGrid" rendered="#{bookingItem.active eq true}">
                <f:setPropertyActionListener target="#{ordrBookingController.selected}"
                    value="#{bookingItem}" />
            </p:commandButton>

            <p:commandButton action="#{ordrBookingController.create}"
                process="@this" value="Cancel" ajax="true" immediate="false"
                update="bookingTable :bookingForm:messagePanel" rendered="#{bookingItem.active eq true}">
                <f:setPropertyActionListener target="#{ordrBookingController.selected}"
                    value="#{bookingItem}" />
                <f:setPropertyActionListener
                    target="#{ordrBookingController.selected.active}" value="#{false}" />
            </p:commandButton>
        </p:column>
    </p:dataTable>
</p:tab>

The p:dataTable bookingTable must be update and other listed on the update attribute. The other tables are being updated, but the bookingTable is not. What is it that is wrong here.

0 个答案:

没有答案