jsf - Cannot get new dataTable value from cellEdit event via PrimeFaces -


this question has answer here:

i have been banging head trying figure out morning , cannot work. basically, cannot new datatable value celledit event via primefaces.

here xhtml page:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"             xmlns:ui="http://java.sun.com/jsf/facelets"              xmlns:p="http://primefaces.org/ui"             xmlns:h="http://java.sun.com/jsf/html"             xmlns:f="http://java.sun.com/jsf/core">  <h:form id="httppolicyform">     <p:datatable id="httptable" var="row" value="#{httppolicybean.rows}" editable="true" editmode="cell">         <f:facet name="header">             http policy         </f:facet>         <p:ajax event="celledit" listener="#{httppolicybean.oncelledit}" update=":httppolicyform:httptable" />         <p:column headertext="property">             <h:outputtext value="#{row.name}" />         </p:column>         <p:column headertext="value">             <p:celleditor>                <f:facet name="output"><h:outputtext value="#{row.value}" /></f:facet>                <f:facet name="input"><p:inputtext value="#{row.value}" style="width:100%"/></f:facet>            </p:celleditor>         </p:column>     </p:datatable>  </h:form> 

and here listener method:

public void oncelledit(celleditevent event) {         object oldvalue = event.getoldvalue();         object newvalue = event.getnewvalue();         printrowvalues();         if(newvalue != null && !newvalue.equals(oldvalue)) {             logger.debug("old: " + oldvalue + ", new:" + newvalue);             facesmessage msg = new facesmessage(facesmessage.severity_info, "cell changed", "old: " + oldvalue + ", new:" + newvalue);             facescontext.getcurrentinstance().addmessage(null, msg);         } } 

the method invoked value of newvalue old value. also, table never updated new value. however, if click on cell again edit value again pulls new value. not sure doing wrong. please me figure out.

the bean sessionscoped.

i able work performing following step:

moved event listener oncelledit() function httppolicybean class new class called policyviewbean , made bean viewscoped.

i noticed in example on pf demo.

btw, trying figure out why getrows() in httpolicybean gets called multiple times when scope sessionscoped. per understanding of sessionscoped, should called once when session first created , list empty.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -