Primefaces 3.0 DataTable inCell编辑,RowEditEvent不检索更新的字段 [英] Primefaces 3.0 DataTable inCell editing , RowEditEvent doesn't retrieve updated field

查看:192
本文介绍了Primefaces 3.0 DataTable inCell编辑,RowEditEvent不检索更新的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个带有primefaces 3的示例应用程序,使用数据表单元格编辑模式。虽然当我编辑时,我看到event.getObjects给了我未修改的对象。

I am working on a sample app with primefaces 3 , using datatables incell editing mode. Although when i edit , i see the event.getObjects gives me the object which is not modified.

在调试模式下更改了对象的属性,它确实更新。

Changed the property of the object on debug mode, it does update.

所以我无法弄清楚为什么我无法获得编辑后的财产。

So i couldn't figure out why i cant get the edited property.

以下是我的eventlistener方法和xhtml;

Below are my eventlistener method and the xhtml;

欢迎任何指针

提前致谢

EventListener

public void editListener(RowEditEvent event){
    System.out.println("EDIT LISTENER");
    update((Employer)event.getObject());

}

JSF:

   <h:form id="form">
                <h1><h:outputText value="List"/></h1>
                <p:dataTable value="#{employer.employers}" var="item" paginator="true" rows="10" style="width:300px">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Id"/>
                        </f:facet>

                        <h:outputText value="#{item.id}"/>
                    </p:column>
                    <p:column headerText="Name">
                        <p:cellEditor>
                            <f:facet name="output">
                                <h:outputText value="#{item.name}"/>
                            </f:facet>
                            <f:facet name="input">
                                <p:inputText value="#{item.name}"></p:inputText>
                            </f:facet>
                        </p:cellEditor>
                    </p:column>
                    <p:column>

                        <f:facet name="header">
                            <h:outputText value="Surname"/>
                        </f:facet>
                        <h:outputText value="#{item.surname}"/>

                    </p:column>
                    <p:column>

                        <f:facet name="header">
                            <h:outputText value="Phone"/>
                        </f:facet>
                        <h:outputText value="#{item.phone}"/>

                    </p:column>
                    <p:column>

                        <f:facet name="header">
                            <h:outputText value="Email"/>
                        </f:facet>
                        <h:outputText value="#{item.email}"/>

                    </p:column>
                    <p:column headerText="Options" style="width:50px">
                        <p:rowEditor />
                    </p:column>
                    <p:ajax event="rowEdit" listener="#{employer.editListener}"></p:ajax>
                </p:dataTable>
            </h:form>


推荐答案

此后......

<p:dataTable value="#{employer.employers}" var="item" paginator="true" 
    rows="10" style="width:300px">

...请填写以下内容:

...put the following:

<p:ajax event="rowEdit" update="@this" listener="#{HandlerClassName.rowEditListener}" />

这篇关于Primefaces 3.0 DataTable inCell编辑,RowEditEvent不检索更新的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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