6 Replies Latest reply on Sep 24, 2009 6:29 AM by tanmay.solanki

    AJAX Reset Button

      I am Richfaces newbie. One of my requirement is for a Reset button.

      1) Reset a set of Richfaces components after a (Reset) button click. Click on this button can be a Ajax call to the back-end manage bean if required.

      2) Is there any way we can re-render a set of Richfaces component through an Ajax call?

      Can any one suggests me a way to achieve this functionality?


        • 1. Re: AJAX Reset Button
          ilya_shaikovsky

          so just write a method which will reset component value bindings, then call the method from some a4j:control and just reRender the panel with components, or just some concrete components set by id/ids

          • 2. Re: AJAX Reset Button

            Thanks for your reply. I got your point to reset all value binding method to default value explicitly in a method, make an Ajax call to this method and re-render related component. This solution is straight forward.

            But is there and way we can have it without writing an explicit method?

            Explanation:
            What I meant to say is when a JSF view is initially constructed we don't have
            to set default value explicitly to any component they just go through a JSF cycle and we get our default values to all components in a page.
            Is there any way I can have partial update for a set of component in a page
            which goes to same initial levels on click of a button.

            • 3. Re: AJAX Reset Button
              nbelaevski

              Just remove them from view in the action method - view handler will create new ones then with the default values.

              • 4. Re: AJAX Reset Button

                Thanks. Can you give a sample code to achive the same ( remove a component from the view handler) or just tell me method to be called from facescontext ?

                • 5. Re: AJAX Reset Button
                  nbelaevski

                   

                  UIComponent parent, child;
                  parent.getChildren().remove(child);


                  • 6. Re: AJAX Reset Button

                    Thanks