7 Replies Latest reply on Jan 24, 2011 10:01 AM by atyauristen

    Rerender programmatically generated part

    atyauristen

      hey,

       

      I have a div in an xhtml page which I'm binding to a backing bean attribute, and I build a complex tree under it. I have a list of comments, their reply comments, their own reply boxes and functions, as you could imagine a community site wall for example.

       

      What I want to do is rerender only a part of that programmatically built tree but I cannot achieve for some unknown reason. I can pass the ID of that very top div to rerender but if I pass the ID of a parent div of a reply box for example, the part does not get rerendered. The whole page uses a single form, all elements use unique, generated IDs which are forced IDs (t:div forceID=true), also I debugged everything, the ajax commands' rerender attributes are correctly set to the generated IDs, but still I cannot see any change. If I set a non-valid ID, in the log I can see 'WARN (AjaxContext) - Target component for id MYID not found' but never the generated and correctly set ID, that's why I assume it's set correctly.

       

      So does someone any idea why it won't work?

       

      Any help is appreciated!

       

      Cheers,

       

      balázs

        • 1. Rerender programmatically generated part
          boy18nj

          Hi balázs,

           

          I just want to make sure you are using <s:div> not <div> in your xhtml and you are trying to rerender <s:div>?

          • 2. Re: Rerender programmatically generated part
            ilya40umov

            To: Aman

            I suppose that Balázs actually is using t:div(tomahawk div implementation).

             

            To: Balázs

            Are you using MyFaces or Mojarra?

            • 3. Rerender programmatically generated part
              atyauristen

              MyFaces, Tomahawk, RichFaces 3.3 - that's what I use.

              • 4. Rerender programmatically generated part
                ilya40umov

                I'm not sure that you haven't already done it but:

                1) add rich:messages on the page

                2) add a4j:log on the page

                3) try to debug getters in your beans to determine if they are fired or not when ajax call is being executed

                4) look into firebug console and find ajax responses from the server. Try to find what you are re-rendering there.

                 

                P.S. try to simplify(as much as it possible) your code and post it here. It will help RF team to check/understand your problem better.

                P.S.S. There also could be some problems with MyFaces so try the same sample with Sun implementation if it's possible.

                • 5. Rerender programmatically generated part
                  atyauristen

                  Thanks for response!

                   

                  1 Already in use

                  2 Added earlier, but I'm not sure what to look for. Do you have any idea which part of the log indicates what part of the tree is rerendered?

                  3 What do you mean by debugging getters? Everything is set correctly, even the tree is built correctly, it's just not getting rerendered on the client side I guess

                  4 Like at 2). I'm not sure what to look for. But trying.

                   

                  PS: the code is about 1800 lines long. I'd rather wait a bit, maybe someone can come up with some idea or experience with dynamic build+rerender

                  • 6. Rerender programmatically generated part
                    atyauristen

                    Well, I tried to debug as much as I could.

                     

                    So, when my a4j:function fires the actionListener, I debug the ActionEvent object and the source of the event if correctly the JS function and its rerender attribute contains the ID of the UIComponent to be rerendered. I also tried to look for that component with a FindComponentByID recursive method starting from the ViewRoot and the component was found.

                     

                    But when I looked at the Firebug console log, I saw that in the response message the ID to rerender is NOT among the Ajax-Update-IDs and also the content-to-update for is missing. So it's just not posted. But after all, that's exactly what is described above, that was just the confirmation. Starting to get desperate :S

                    • 7. Rerender programmatically generated part
                      atyauristen

                      Problem solved. It had not much to do with RichFaces but more a general JSF mistake was made by me. Somehow the list was rebuilt by new objects, including the rerenderer JS function, thus they were not present in the tree to do their jobs. Now that is an awkward mistake to commit but I learned a lot of it