Cell edit in primefaces is not updating the value

家住魔仙堡 提交于 2019-12-02 03:15:20

from Where You are invoking custRowEdit(RowEditEvent event) method. I have not any related thing in your code.

In order to make your listener invoke add below attribute in your datatable declaration.

rowEditListener="#{customerBean.listenerInBackingBean}"

<p:dataTable var="customer" value="#{customerBean.customers}" paginator="true" selection="#{customerBean.selectedCustomer}" 
            selectionMode="single" onRowSelectUpdate=":custList" onRowSelectComplete="custTab.show()" id="custList" widgetVar="custList" update=":custList">
                <f:facet name="header"

rowEditListener="#{customerBean.cutRowEvent}"
>

Check the implementation of customerBean.customers. I reloaded the content from the database every time the method got called. Wrong. This should happen in the constructor instead. Now everything works fine. Thought it was a JavaScript error ...

Thanks this helped me.

May I add that instead of loading the list from a query in the constructor, if one has a @SessionScoped managed bean one can instead use a reset() method to reset lists to null and then lazily populate the lists from the query. The reset can then be called on page load using an f:event:

    <f:view>
        <f:metadata>
            <f:event type="preRenderView" listener="#{sessionScopedBean.reset}"/>
        </f:metadata>
    </f:view>        

I encountered a similar situation that was resolved by removing the update="" tag from the dataTable. The table's default behavior is to update the row, which evidently, in my case, was not occurring.

Mikey

You are missin the p:ajax event to trigger the method, function or whatever you wanna do after the cell editing

it's something like

<p:ajax event="cellEdit" listener="#{mBean.onCellEdit}" update="elementX" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!