我正在使用 Primefaces 3.5 2012 年 12 月 5 日的快照,以及 Mojarra 2.1.14 和 Tomcat 7.0.33。
当对 POJO 对象使用单元内编辑模式(非行内)时,无论何时单击对象然后单击通过单击其他对象,前一个对象将显示其值而不是其标签。这只是“装饰”,因为当您重新加载页面时,它将显示标签值。
<p:dataTable id="insurancepolicyTable" var="insurancepolicy" widgetVar="insurancepolicyList" value="#{insurancepolicybean.objectList}" paginator="true" rows="15" paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" currentPageReportTemplate="#{text['table.insurancepolicy.filter.count']}" rowsPerPageTemplate="15,25,50,100" emptyMessage="#{text['table.insurancepolicy.filter.notfound']}" filteredValue="#{insurancepolicybean.filteredObject}" editable="true" editMode="cell" cellEditEvent="click" draggableColumns="true" rowKey="#{insurancepolicy.id}" >
<p:column id="branchColumn" headerText="#{text['label.branch']}" sortBy="#{insurancepolicy.branch.name}" filterBy="#{insurancepolicy.branch.name}" filterMatchMode="contains">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{insurancepolicy.branch.name}" />
</f:facet>
<f:facet name="input">
<div class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all">
<p:selectOneMenu id="branchselectinsurancepolicylist" value="#{insurancepolicy.branch}" styleClass="customSelect" converter="omnifaces.SelectItemsIndexConverter">
<f:selectItems value="#{insurancepolicybean.branchList}" var="branch" itemLabel="#{branch.name}" itemValue="#{branch}" />
</p:selectOneMenu>
</div>
</f:facet>
</p:cellEditor>
</p:column>
<p:ajax event="cellEdit" listener="#{insurancepolicybean.onEdit}" update="@form" />
<pe:resetInput event="cellEdit" for="@form" />
</p:dataTable>