Primefaces 3.5 + OmniFaces 1.3 SelectOneMenu的SelectItemsIndexConverter问题 [英] Primefaces 3.5 + OmniFaces 1.3 SelectItemsIndexConverter issue with SelectOneMenu

查看:109
本文介绍了Primefaces 3.5 + OmniFaces 1.3 SelectOneMenu的SelectItemsIndexConverter问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Primefaces 3.5 2012年12月5日SNAPSHOT,Mojarra 2.1.14和Tomcat 7.0.33。

I'm using Primefaces 3.5 5th December 2012 SNAPSHOT, with Mojarra 2.1.14 and Tomcat 7.0.33.

使用单元格内编辑模式时(不是对于具有模型/实体类的POJO对象的行内行为,在ah:selectOneMenu中,使用'click'作为celleditevent值,每当您单击一个对象然后通过单击其他对象'click away'时,上一个对象显示其值而不是其标签。这只是装饰性,因为当你重新加载页面时,它会显示标签值。

When using the in-cell editing mode (not in-row) for POJO objects with a model/entity class that are represented in a h:selectOneMenu, with 'click' as the celleditevent value, whenever you click on an object and then 'click away' by clicking on some other object, the previous object is displaying its value instead of its label. This is only 'cosmetic' as when you reload the page, it will show the label value.

<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>  


推荐答案

我可以重现它。这是PrimeFaces中的一个错误。此问题与转换器无关。问题只是由PrimeFaces特定的JavaScript代码引起的,该代码在unedit之后错误地重新显示所选选项的值而不是所选选项的标签。

I can reproduce it. It's a bug in PrimeFaces. This problem is not related to the converter. The problem is just caused by PrimeFaces-specific JavaScript code which incorrectly redisplays the value of the selected option instead of the label of the selected option after "unedit".

这更容易再现如下:

<p:selectOneMenu value="#{insurancepolicy.branchAsString}">                      
    <f:selectItems value="#{insurancepolicybean.branchMap}" />
</p:selectOneMenu>

with

private Map<String, String> branchMap;

@PostConstruct
public void init() {
    branchMap = new LinkedHashMap<String, String>();
    branchMap.put("branch label 1", "branch value 1");
    branchMap.put("branch label 2", "branch value 2");
    branchMap.put("branch label 3", "branch value 3");
}

我建议报告给PrimeFaces的人。

I recommend to report it to PrimeFaces guys.

这篇关于Primefaces 3.5 + OmniFaces 1.3 SelectOneMenu的SelectItemsIndexConverter问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆