I have datatable which displays some pre existing data in input texts, which user can modify if wanted. It also displays a row of empty input boxes to add new data. Now the requirement is that once user is finished entering data in one row, I want to update that row in the database. The data should be saved if user enters/changes data into any of the columns of the selected row.
Is there a way to call an action and save the data when the user moves away from the selected row? I mean is there something like "rowBlurEvent", which is fired when user moves on to some other component on the page?
here is my code.
Code: Select all
<p:dataTable id="nPoints" var="point" value="#{bean.nPoints}"
width="100%" rows="10" selectionMode="single">
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle['title_tab_n']}" />
</f:facet>
<h:inputText id="bmPoint" value="#{point.bmPoint}" escape="false"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle['title_tab_p']}" />
</f:facet>
<h:inputText id="bpPoint" value="#{point.bpPoint}" escape="false"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle['title_tab_z']}" />
</f:facet>
<h:inputText id="zPoint" value="#{point.zPoint}" escape="false"/>
</p:column>
</p:dataTable>