I’m using Primesfaces’ Incell editing in a p:dataTable.
When choosing a new id in the selectOneMenu, I’d like to update the ‘name’ field in the same row without having to wait until the user presses the ok check mark for the name field to be updated. Objects’ name attribute is updated in bean.idEdited(object).
I was hoping I could just use f:ajax render=”name” to update the other field like this:
<h:form>
<p:dataTable var="object" value="#{bean.objects}"
<p:column>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{bean.objectId}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{bean.objectId}">
<f:selectItems value="#{bean.objectIds}" />
<f:ajax listener="#{bean.idEdited(object)}"
render="name" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<h:outputText id="name" value="#{object.name}" />
</p:column>
</p:dataTable>
</h:form>
When I try render=”name” I get this:
SEVERE: Error Rendering View[/logicalAddress.xhtml]
java.lang.IllegalStateException: PWC3999: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2867)
...
Using
Primesfaces 2.2.1
Netbeans 7.0.1
JSF Bundled with Netbeans
Ideas, other ways or salvation?
edit: p:ajax renders the same result.
This is happening because when you are calling ajax to render the page, that page is already rendered.
TIP: If you use primefaces you could also use primefaces components where this is possible. Also upgrade to
Primefaces 3.0.M4for a better implementation. You also have aprimefaces selectOneMenu component, and you can useprimefaces ajax (p:ajax event="onchange")withupdateattribute (update the entire form)