1 Reply Latest reply on Aug 31, 2010 2:18 AM by semua60

    How to get inputtext value from (datatable + datascroller)

    semua60 Newbie

      Hello,

       

      I've a datatable with datascroller and a commandButton. A column in datatable is an inputtext

       

       

                  <rich:dataTable id="table" value="#{testBean.list}" var="item" rows="15" >
                      <rich:column>
                          <f:facet name="header">
                              <h:outputText value="Id" />
                          </f:facet>
                          <h:outputText value="#{item.id}" />
                      </rich:column>
                     
                      <rich:column>
                          <f:facet name="header">
                              <h:outputText value="Note" />
                          </f:facet>
                          <h:inputText id="txtNote" value="#{testBean.noteMap[item.id]}" />
                      </rich:column>
                                    
                      <f:facet name="footer">
                          <rich:datascroller id="scroller" for="table" actionListener="#{testBean.scrollerActionListener}" />
                      </f:facet>
                  </rich:dataTable>
                  <h:commandButton value="Save" action="#{testBean.saveAction}" />
      I want to capture value in the inputtext and save into session before user move to another page.
      So I declare an actionListener in datascroller, to capture value inputtext in the current page. Before datatable move to next/prev page.
      The problem is, the variable noteMap is still empty (I can't get it from inside scrollerActionListener).
      If button 'Save' click, I can get the inputtext value, but only at the current page. Value in another page was gone.
      Anyone can help?
      private Map<String, String> noteMap = new HashMap<String, String>();

      public void scrollerActionListener(ActionEvent event) {
          log.info(noteMap);
          //save noteMap into Session
          ....
      }

      public String saveAction() {
          //load noteMap from Session
          ...
          return "";
      }

       

       

       

      Thanks,