简体   繁体   English

Primefaces p:celleditor celledit

[英]Primefaces p:celleditor celledit

I'm implementing ap:dataTable component, based on the Primefaces Showcase 我正在基于Primefaces Showcase实现ap:dataTable组件

The code is: 代码是:

<p:dataTable
    id="newDataTable"
    editable="true"
    editMode="cell"
    var="item"
    value="#{myBean.listNewDataTable}">

    <p:ajax event="cellEdit" listener="#{myBean.newCellEditListener}" update="@this"/>
    <p:column width="150" >
        <p:cellEditor>
            <f:facet name="output">
                <h:inputText value="#{item.description}" readonly="true"/>
            </f:facet>
            <f:facet name="input">
                <p:selectOneMenu value="#{item.id}" style="width: 90%;">
                    <f:selectItems value="#{myBean.productsMap.entrySet()}" var="entry" itemValue="#{entry.key}" itemLabel="#{entry.value}" />
                </p:selectOneMenu>
            </f:facet>
        </p:cellEditor>
    </p:column>
    -- More Data --
</p:dataTable>

And the backing bean method: 和后备豆方法:

public void newCellEditListener(CellEditEvent event){
    ... Some work here ...
}

When the value on the editable cell is changed, the p:cellEditor works as expected. 更改可编辑单元格上的值后,p:cellEditor会按预期工作。

The problem is: 问题是:

When the value on the editable cell remains unchanged, the p:cellEditor shows the item.id when it should actually be showing the item.description. 当可编辑单元格上的值保持不变时,p:cellEditor实际应显示item.description时显示item.id。

Am I missing something obvious? 我是否缺少明显的东西? Do I need additional configuration? 我是否需要其他配置?

I have been googling for a tip or an answer, without success. 我一直在搜寻技巧或答案,但没有成功。

UPDATE UPDATE

Same problem persists on the following code: 以下代码仍然存在相同的问题:

<p:column headerText="Money" width="150" >
    <p:cellEditor >
        <f:facet name="output">
            <h:inputText value="#{actual.money}" readonly="true">
                <f:convertNumber type="currency" />
            </h:inputText>
        </f:facet>
        <f:facet name="input">
            <h:inputText value="#{actual.money}">
            </h:inputText>
        </f:facet>
    </p:cellEditor>
</p:column>

The value on the backing bean its the same for input and output, the difference between each other should be the 'currency' format. 对于输入和输出,后备bean上的值相同,彼此之间的差异应为“货币”格式。

UPDATE UPDATE

As a workaround I used "p:commandButton" to update the Datatable. 解决方法是使用“ p:commandButton”更新数据表。

<p:commandButton icon="ui-icon-refresh" update="newDataTable" value="Update" />

The app is running on: 该应用正在运行:

  • Primefaces 3.5 Primefaces 3.5
  • Primefaces Extensions 0.7.1 Primefaces扩展0.7.1
  • Mojarra 2.1.22 Mojarra 2.1.22
  • Tomcat 7 雄猫7

Thanks for your help. 谢谢你的帮助。 Kind regards. 亲切的问候。

Values in output and input should be the same. 输出和输入中的值应该相同。 Try to fix that. 尝试解决该问题。

Found the issue reported and fixed on the Primefaces issue site: http://code.google.com/p/primefaces/issues/detail?id=6116 在Primefaces问题网站上找到了已报告并已修复的问题: http : //code.google.com/p/primefaces/issues/detail? id=6116

I downloaded the 4.0.RC1 and I do see the issue as being resolved as reported but there are some major differences in 4.0 versus 3.5 so I'm going to be waiting for 3.5.15 to be released. 我下载了4.0.RC1,确实看到报告已解决此问题,但是4.0与3.5之间存在一些主要差异,因此我将等待发布3.5.15。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM