3 Replies Latest reply on Jun 23, 2010 4:49 AM by it_is_andrew

    commandbutton inside datagrid problem! urgent, please help

    it_is_andrew

      We have a richfaces Datagrid in which in each row there is a commandbutton.
      The commandbutton fires a method of a stateless session bean which outjects a simple java bean and returns another page url to forward.
      My problem is the commandbutton is showing erratic behaviour , if we are too early to click on the button (before the page completely loads) - it just returns to the same page (method is fired)


      I tried to disable the buttons by default and enable it only after page load ; this is always leading to same page re render problem on button click.
      (if we use commandlink instead of commandbutton it never forwards either)


      Also one thing I noticed that the stateless bean method is being fired multiple number of times (equal to the no of rows in the datagrid!)


      we are using seam 2.1.2


      Any idea what we are doing wrong here?!!


      Please suggest any approach or let me know if you need any further information.

        • 1. Re: commandbutton inside datagrid problem! urgent, please help
          hbender

          I'm sorry that I cannot give you an answer to your original problem. But this:



          I tried to disable the buttons by default and enable it only after page load ; this is always leading to same page re render problem on button click. (if we use commandlink instead of commandbutton it never forwards either)


          I found the strange effect that a h:commandbutton which is disabled by default will not be rendered with an action handler. It just is a plain form submit button in the rendered HTML. This would explain the simple rerendering of the same page. Look at the source code in the browser!


          Heri


          • 2. Re: commandbutton inside datagrid problem! urgent, please help
            it_is_andrew

            Heri Bender wrote on Jun 23, 2010 04:20:


            I'm sorry that I cannot give you an answer to your original problem. But this:

            I tried to disable the buttons by default and enable it only after page load ; this is always leading to same page re render problem on button click. (if we use commandlink instead of commandbutton it never forwards either)


            I found the strange effect that a h:commandbutton which is disabled by default will not be rendered with an action handler. It just is a plain form submit button in the rendered HTML. This would explain the simple rerendering of the same page. Look at the source code in the browser!

            Heri

            Thaks Heri, but I noticed when I disable the comandbutton by default and enable it on page load, it still calls the stateless bean method (multiple times - for each row) but it never forwards to the next page (which is returned by the method).



            Click HELP for text formatting instructions. Then edit this text and check the preview.

            • 3. Re: commandbutton inside datagrid problem! urgent, please help
              it_is_andrew

              Sorry there was no edit button so could not edit the previous post, I put my response in quote itself!


              What I said is:
              Thaks Heri, but I noticed when I disable the comandbutton by default and enable it on page load, it still calls the stateless bean method (multiple times - for each row) but it never forwards to the next page (which is returned by the method).