0
I am trying to edit a cell in my data table and get error. follow my bean :
@Named
@ViewScoped
public class PesquisaPrevisaoBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private Historicos previsoes;
private List<Historico> listaDePrevisoes;
private Historico previsaoSelecionada;
private PrevisaoLazyList lazyPrevisoes;
public List<Historico> getPrevisoes() {
return listaDePrevisoes;
}
public void inicializar() {
// carregarListaHistoricos();
lazyPrevisoes = new PrevisaoLazyList(previsoes);
}
public void onCellEdit(CellEditEvent event) {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
if (newValue != null && !newValue.equals(oldValue)) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Cell Changed",
"Old: " + oldValue + ", New:" + newValue);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
Follow the view:
<p:column headerText=" Previsão1"style="text-align: center; width: 140px">
<p:cellEditor>
<h:outputText value="#{historico.produto.quantidadeRecente}">
</h:outputText>
</p:cellEditor>
</p:column>`
Follow the Stacktrace:
2017-05-19 18:45:53,035 ERROR [br.com.previsao.util.jsf.Jsfexceptionhandler] System error: null java.lang.Nullpointerexception at org.primefaces.Component.celleditor.Celleditorrenderer.encodeEnd(Celleditorrenderer.java:38) at javax.faces.Component.UIComponentBase.encodeEnd(Uicomponentbase.java:881) at javax.faces.Component.UIComponent.encodeAll(Uicomponent.java:1786) at javax.faces.Component.UIComponent.encodeAll(Uicomponent.java:1782) at org.primefaces.Component.datatable.Datatablerenderer.encodeCell(Datatablerenderer.java:808) at org.primefaces.Component.datatable.Datatablerenderer.encodeRow(Datatablerenderer.java:773) at org.primefaces.Component.datatable.Datatablerenderer.encodeTbody(Datatablerenderer.java:651) at org.primefaces.Component.datatable.Datatablerenderer.encodeRegularTable(Datatablerenderer.java:234) at org.primefaces.Component.datatable.Datatablerenderer.encodeMarkup(Datatablerenderer.java:196) at org.primefaces.Component.datatable.Datatablerenderer.encodeEnd(Datatablerenderer.java:82) at javax.faces.Component.UIComponentBase.encodeEnd(Uicomponentbase.java:881) at javax.faces.Component.UIComponent.encodeAll(Uicomponent.java:1786) at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) javax.faces.Component.UIComponentBase.encodeChildren(Uicomponentbase.java:851) at javax.faces.Component.UIComponent.encodeAll(Uicomponent.java:1779) at javax.faces.Component.UIComponent.encodeAll(Uicomponent.java:1782) at javax.faces.Component.UIComponent.encodeAll(Uicomponent.java:1782) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Faceletviewhandlingstrategy.java:439) at com.sun.faces.application.view.MultiViewHandler.renderView(Multiviewhandler.java:124) at javax.faces.application.ViewHandlerWrapper.renderView(Viewhandlerwrapper.java:286) at javax.faces.application.ViewHandlerWrapper.renderView(Viewhandlerwrapper.java:286) with.sun.faces.lifecycle.Renderresponsephase.execute(Renderresponsephase.java:120))
You are calling this method within a p:ajax?
– DiegoAugusto
within a datamodel Lazy
– user2509556