0

我有一个像这样的代码:

<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>立即反映。但它不会发生。

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

在 JSF2.0、primefaces 3.4.2、Jboss As7.1.1final 和 JDK6.0 上工作。豆在@ViewScoped。请建议。提前致谢。

4

0 回答 0