1 Reply Latest reply on Mar 3, 2009 9:23 AM by nbelaevski

    Using inplaceInput with valueChangeListener within a rich:da

      Hello all,

      I have a rich:dataTable that shows a list of beans for which one of the bean's properties should be editable through a rich:inplaceInput. I am trying to use the valueChangedListener model, but I am having trouble figuring out how to know the entity ID of the specific bean in my table that is being edited. Does anyone have suggestions of how I could do this?

      <rich:dataTable value="#{myList}" var="_bean">
       <rich:column>#{_bean.artist}</rich:column>
       <rich:column>
       <rich:inplaceInput value="#{_bean.album}" valueChangeListener="#{beanHome.saveAlbumListener}" immediate="true" />
       </rich:column>
      </rich:dataTable>


      What I need is to pass the ID of _bean for the row, and the name of the field being changed so that the beanHome object knows which entity to update. At first I tried using a4j:actionparams, but using those with immediate="true" only happens after the SECOND time I change the inplaceInput value:

      <rich:dataTable value="#{myList}" var="_bean">
       <rich:column>#{_bean.artist}</rich:column>
       <rich:column>
       <rich:inplaceInput value="#{_bean.album}" valueChangeListener="#{beanHome.saveAlbumListener}" immediate="true">
       <a4j:actionparam name="ii_param_id" value="#{_bean.id}" assignTo="#{beanHome.currentEntityId}" />
       <a4j:actionparam name="ii_param_field" value="album" assignTo="#{beanHome.currentEntityField}" />
       </rich:inplaceInput>
       </rich:column>
      </rich:dataTable>


      In other words, I change the value once and the value change listener is the only method called; then when I change the value again, the 2 actionparam methods are called (with the values from the first change), then the VCL is called again.

      Is there another way I can pass this additional information in with my valueChangeListener? I am using the Seam beanHome object so that I can persist my changes as they occur, so that is why I'm not using a VCL within the actual entity bean.

      Thanks for the help.