Hi all,
I need to create a dataTable with some fields editable. I've found one example on the Web which persists data in one shot using a command button:
<h:form>
<h:rich:dataTable value="#{myBean.dataList}" var="dataItem">
<h:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{dataItem.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:inputText value="#{dataItem.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Value" />
</f:facet>
<h:inputText value="#{dataItem.value}" />
</h:column>
</h:rich:dataTable>
<br/>
<h:commandButton value="Save" action="#{myBean.saveDataList}" />
</h:form>
public class MyBean {
public String saveDataList() {
try {
dataDAO.save(dataList);
} catch (DAOException e) {
setErrorMessage(e.getMessage() + " Cause: " + e.getCause());
e.printStackTrace();
}
return "list"; // Navigation case.
}
}
however I'd need to intercept with a listener the Row changed.
In the past I've used IceFaces and rowEventListener, is there an equivalent in richfaces 4 ?
Thanks a lot
mark
add valueChangeListener to the inputs. And mark the objects as changed when called.