I am using the edit pencil of the row edit datatable in prime faces edit pencil. Here is the jsf page in the website of primefaces
<h:form id="form">
<p:growl id="msgs" showDetail="true"/>
<p:dataTable id="cars1" var="car" value="#{dtEditView.cars1}" editable="true" style="margin-bottom:20px">
<p:ajax event="rowEdit" listener="#{dtEditView.onRowEdit}" update=":form:msgs" />
<p:ajax event="rowEditCancel" listener="#{dtEditView.onRowCancel}" update=":form:msgs" />
<p:column headerText="Id">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.id}" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="#{car.id}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:32px">
<p:rowEditor />
</p:column>
</p:dataTable>
</h:form>
and here is the onRowEdit in the managed bean
public void onRowEdit(RowEditEvent event) {
FacesMessage msg = new FacesMessage("Car Edited", ((Car) event.getObject()).getId());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
In the EditView bean, i tried to make the signature like this public String onRowCancel(RowEditEvent event)
to redirect to another page after row edit, it is ignored.
I tried this
public String onRowEdit(RowEditEvent event) {
FacesMessage msg = new FacesMessage("Car Edited", ((Car) event.getObject()).getId());
FacesContext.getCurrentInstance().addMessage(null, msg);
return "success";
}
but it didn't redirect to the success page, it just prints the Car Edited msg with its id. I want a way to redirect to another page after the row editing method. How can it be done?