【发布时间】:2012-11-23 05:52:59
【问题描述】:
我正在使用 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>
【问题讨论】:
-
您是否暗示它在不使用
SelectItemsIndexConverter时按预期工作? -
没有。它适用于没有转换器的简单字符串数组的 selectonemenus。
-
当它工作时,您是否使用相同的字符串值作为项目值和项目标签?这看起来很像 PrimeFaces 错误,其中选项值在编辑后重新显示,而不是选项标签。这不是由 OmniFaces 转换器引起的。
-
我使用了相同的值/标签对。我想这就是它似乎“起作用”的原因。
标签: java jsf primefaces omnifaces