5 Replies Latest reply on Aug 25, 2009 9:58 AM by badjan

    rich:inputNumberSpinner in a table

      I am using the rich:inputNumberSpinner inside a table of Widget objects on an order form to represent the quantity of widgets desired. Also on the form are the total for each widget (quantity * price) and the total for the entire order.

      As you might suspect, I need to have those totals updated instantaneously when the spinner is updated. The problem is that if I try to use a valueChangeListener method, I don't have access to the individual widget whose quantity was updated (because the sole parameter is the ValueChangeEvent object). I have considered ugly hacks like naming my spinners in a clever way and using that information in my Java code, but that is so lame.

      Any insight into how I can accomplish this in a more elegant way?

      Thanks.

        • 1. Re: rich:inputNumberSpinner in a table
          ilya_shaikovsky

          please paste current code snippet.

          • 2. Re: rich:inputNumberSpinner in a table

            Thanks, Ilya, but I figured it out. It was simply a matter of using a4j:support, which I thought only applied to standard JSF components.

            • 3. Re: rich:inputNumberSpinner in a table
              badjan

              Hi,

              could you please post your solution.
              I've got a similar problem an just can't find how to use a4j:support correctly.

              Would be nice if you could help me :)

              <rich:dataTable value="#{actSoStory.soStoryAdvancedList}" var="ssa3">
              <rich:column>
              <rich:inputNumberSpinner value="#ssa3.saPageNumber}">
              <a4j:support action="updateSsaPageNum" reRender="#{flowRenderFragments}" event="onchange"/>
              </rich:inputNumberSpinner>
              </rich:column>
              </rich:dataTable>
              


              Question is, how to access "ssa3"?
              Normaly I would use something like:
              <f:setPropertyActionListener value="#{ssa3}" target="#{StoryBB.storyAdvancedSelectedRow}" />
              


              But it is not possible to set f:setPropertyActionListener within the inputNumberSpinner.

              ...so I just want to update (via ajax) ssa3 when pageNum is changed by the numberSpinner.

              Would be great if you or someone else could help me :)

              Bests,

              Jan

              • 4. Re: rich:inputNumberSpinner in a table
                ilya_shaikovsky

                 

                But it is not possible to set f:setPropertyActionListener within the inputNumberSpinner.


                But it's possible to define it inside support ;)

                • 5. Re: rich:inputNumberSpinner in a table
                  badjan

                  Ahh... yeah :)
                  It's working this way !
                  Thanks a lot ;)