<p:datatable>部分进程不会立即反映更改</p:datatable>

时间:2013-06-17 13:33:09

标签: jsf-2 primefaces

我有一个代码:

<p:dataTable style="padding-top: 5px" var="leaveDetails" value="#{userLeaveBean.leaveDetails}" id="leaveDataTable" editable="true">
                    <p:column headerText="Leave Starts on" width="230">
                            <p:calendar valueChangeListener="#{userLeaveBean.handleFromDateChanege}" value="#{leaveDetails.dtLeaveFromDate}" pattern="dd-MMM-yyyy" size="16" showOn="button" id="editFrom">
                                <p:ajax event="dateSelect"/>
                            </p:calendar>
                            <h:selectOneRadio value="#{leaveDetails.strStartTiming}" valueChangeListener="#{userLeaveBean.handleRadioFirstValueChange}">
                                <f:selectItem itemValue="morning" itemLabel="Morning"/>
                                <f:selectItem itemValue="afternoon" itemLabel="Afternoon" />
                                <p:ajax event="click"/>
                            </h:selectOneRadio>
                    </p:column>
                    <p:column headerText="Leave Ends on" width="230">
                            <p:calendar valueChangeListener="#{userLeaveBean.handleToDateChanege}" value="#{leaveDetails.dtLeaveToDate}" pattern="dd-MMM-yyyy" size="16" showOn="button" id="editTo">
                                <p:ajax event="dateSelect"/>
                            </p:calendar>
                            <h:selectOneRadio value="#{leaveDetails.strEndTiming}" valueChangeListener="#{userLeaveBean.handleRadioSecondValueChange}">
                                <f:selectItem itemValue="noon" itemLabel="Noon"/>
                                <f:selectItem itemValue="endofday" itemLabel="End Of Day"/>
                                <p:ajax event="click"/>
                            </h:selectOneRadio>
                    </p:column>
                    <p:column headerText="Days" width="40" id="total">
                        <h:outputText value="#{leaveDetails.totalLeaveDays}"/>
                    </p:column>
                    <p:column headerText="Creation" width="100">
                        <h:outputText value="#{leaveDetails.dtApplicationDate}">
                            <f:convertDateTime pattern="EEEE,dd-MMM-yyyy"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Status" width="100">
                        <h:outputText value="#{leaveDetails.strLeaveStatus}"/>
                    </p:column>
                    <p:column headerText="Edit" width="40" rendered="#{leaveDetails.strLeaveStatus == 'Canceled' or leaveDetails.strLeaveStatus == 'Availed'}">
                            <p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="true" update="leaveDataTable" immediate="true" partialSubmit="true">
                                <h:graphicImage url="resources/images/edit.JPG"/>
                                <f:attribute name="userId" value="#{employee.name}"/>
                                <f:attribute name="editFirstHalf" value="#{leaveDetails.strStartTiming}"/>
                                <f:attribute name="editSecondHalf" value="#{leaveDetails.strEndTiming}"/>
                                <f:attribute name="editFrom" value="#{leaveDetails.dtLeaveFromDate}"/>
                                <f:attribute name="editTo" value="#{leaveDetails.dtLeaveToDate}"/>
                                <f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
                            </p:commandLink>
                    </p:column>
                    <p:column headerText="Edit" width="40" rendered="#{leaveDetails.strLeaveStatus != 'Canceled'}">
                            <p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="false" update="leaveDataTable" immediate="true" process="@this" >
                                <h:graphicImage url="resources/images/edit.JPG"/>
                                <f:attribute name="userId" value="#{employee.name}"/>
                                <f:attribute name="editFirstHalf" value="#{leaveDetails.strStartTiming}"/>
                                <f:attribute name="editSecondHalf" value="#{leaveDetails.strEndTiming}"/>
                                <f:attribute name="editFrom" value="#{leaveDetails.dtLeaveFromDate}"/>
                                <f:attribute name="editTo" value="#{leaveDetails.dtLeaveToDate}"/>
                                <f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
                            </p:commandLink>
                    </p:column>
                    <p:column headerText="Cancel" width="60" rendered="#{leaveDetails.strLeaveStatus == 'Canceled' or leaveDetails.strLeaveStatus == 'Availed'}">
                            <p:commandLink actionListener="#{userLeaveBean.cancelForLeave}" title="Cancel Request" disabled="true" process="@this" update="leaveDataTable" immediate="false">
                                <h:graphicImage url="resources/images/cancel.gif"/>
                                <f:attribute name="userId" value="#{employee.name}"/>
                                <f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
                            </p:commandLink>
                    </p:column>
                    <p:column headerText="Cancel" width="60" rendered="#{leaveDetails.strLeaveStatus != 'Canceled'}">
                            <p:commandLink actionListener="#{userLeaveBean.cancelForLeave}" title="Cancel Request" disabled="false" process="@this" update="leaveDataTable" immediate="false" ajax="true">
                                <h:graphicImage url="resources/images/cancel.gif"/>
                                <f:attribute name="userId" value="#{employee.name}"/>
                                <f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
                            </p:commandLink>
                    </p:column>
                </p:dataTable>

这部分代码是用<p:datatable>编写的。这意味着<p:datatable>的行操作。点击<p:commandLink>一些执行就发生了,我希望它反映在<p:datatable> immediatley。但它不会发生。

如果我刷新页面,则更改会反映<p:datatable>的行。如何修改我的代码以立即反映更改。

使用JSF2.0,primefaces 3.4.2,Jboss As7.1.1final和JDK6.0。 Bean在@ViewScoped。 请建议。 提前谢谢。

0 个答案:

没有答案