1 Reply Latest reply on Jul 9, 2007 6:33 AM by Pete Muir

    Getting an updated data model selection

    amitdk Newbie

      I have a JSF page that allows one of the dataTable columns to be updated. However the selected row update to certain elements of a row doesn't seem to come through in the DataModelSelection. Is the DataModel not updatable? I would imagine it would be - however I always get the old value back in my session bean.

      Here's how the JSF page looks:

      <h:form id="taskedit">
       <h1>Your Weekly Tasks:</h1>
       <h:outputText value="No tasks added for this week" rendered="#{weeklyTasks.rowCount==0}"/>
       <rich:dataTable value="#{weeklyTasks}"
       var="wtask" rendered="#{weeklyTasks.rowCount>0}"
       <a:support event="onRowDblClick" action="#{report.updateTask}" reRender="taskedit"/>
       <rich:column rendered="#{not report.taskEditable}">
       <f:facet name="header">Assigned Task</f:facet>
       <h:outputText value="#{wtask.comments}"/>
       <rich:column rendered="#{report.taskEditable}">
       <f:facet name="header">Assigned Task</f:facet>
       <h:inputTextarea rows="5" cols="80" value="#{wtask.comments}"/>
       <f:facet name="header">action</f:facet>
       <s:button action="#{report.saveTask}" value="Save Task" />
       <f:facet name="header">action</f:facet>
       <s:button action="#{report.removeTask}" value="Remove Task" />

      Here's how the session bean looks:
      public class ReportBean implements Report, Serializable
       private static final long serialVersionUID = 8545529442081579216L;
       @PersistenceContext(type = PersistenceContextType.EXTENDED)
       EntityManager entityMgr;
       User user;
       List<TaskAssignment> weeklyTasks;
       private TaskAssignment selectedTask;
       public void showTasks()
       weeklyTasks = entityMgr
       // Here's the method I expect to get the updated comments
       public void saveTask()
       System.out.println( selectedTask.getComments() );

      On a double click on a row on the dataTable, the comments field becomes editable, however the submit and corresponding invocation of saveTask does not give me the latest edited value.

      Is there something I am missing here in terms of how you capture an edited row value?

      Any help is appreciated.
      Amit Karandikar