Primefaces DataTable filtering and RowSelection not working

耗尽温柔 提交于 2019-12-06 16:01:30

What i Undestand from your question is you want create an Editable DataTable. As you are using dataTable attribute selectionMode="Single" which seems everything right for me. I cant say what went wrong with it as it involved many other complexities. But you can achieve the samething (populating selectedCustomer In Backing bean)

Solution1: you implement Below listener

 rowEditListener="#{customerBean.listenerInBackingBean}"

And In backing bean..........

 public void listenerInBackingBean(org.primefaces.event.RowEditEvent ev) {

        Customer selectedCustomer  = (Customer) ev.getObject();
        //write Logic to Store Customer in Database

}

Solution 2:

 <p:commandButton >
  <f:setPropertyActionListener value="#{customer}" target="#{customerBean.selectedCustomer}" />
 </p:commandButton>

Here selectedCustomer is instance of type Customer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!