6 Replies Latest reply on Aug 31, 2009 5:20 AM by nbelaevski

    Writing fast A4J Pages

      A4J allows for partial submit such as, see a4j:region and ajaxSingle attr and process attr. Not only do you get to partially render a page, u can also submit specific parts of the page with A4J. I’ve recently optimized a bunch of JSF pages that use A4J and even large tables can be partially rendered by specifying the specific rows you want re-rendered. This allowed me to write complex pages with fast ajax actions.

      So far the only thing I still can’t get good performance with A4J is adding/deleteing a row from a table, as it still has to re-renders the entire table instead of just appending a row :(

      A simple table with a couple input text fields can get sluggish with just 10-15 rows. Anyone know a way to make this quicker? I'm already using ajaxSingle ="true" and even immediate="true" bit the slowness isn't with submitting, it's with the re-rendering of the entire table.

        • 1. Re: Writing fast A4J Pages
          nbelaevski

          Hi,

          Insertion of table row by AJAX doesn't work well in some of supported browsers and also rich:dataTable doesn't have built-in support for row re-rendering.

          You can try using another parser (e.g. NEKO instead of TIDY) and check change in performance.

          • 2. Re: Writing fast A4J Pages

            Actually rich:dataTable does support row re-rendering by the use of ajaxKeys. However that only works for rows already existing, not adding new rows or removing rows. I tried the NEKO, but got a class not found exception, so I tried NONE, and the performance isn't scalable still. You're right tho, even if I can insert just a row without re-rendering entire table, some browsers don't work well this TR tags being inserted.

            "nbelaevski" wrote:
            Hi,

            Insertion of table row by AJAX doesn't work well in some of supported browsers and also rich:dataTable doesn't have built-in support for row re-rendering.

            You can try using another parser (e.g. NEKO instead of TIDY) and check change in performance.


            • 3. Re: Writing fast A4J Pages
              nbelaevski

              That's not rows re-rendering, but re-rendering table cells or their content limited to a particular rows. Try changing row class by AJAX in rich:dataTable and you'll see that it doesn't change.

              I was prototyping dynamic rows update for tree table component ~ three months ago and the problem I've got was that FF table rows updated via AJAX doesn't behave well (in one of xHTML or HTML modes - I don't remember that for sure); also in the older RF versions rows update in IE wasn't possible at all.

              • 4. Re: Writing fast A4J Pages

                Fair enough. I wonder if the ALAX slowness it due to JSF's nature or Richfaces. I've re-rendered an entire table to add rows with similar components in it, but via Prototype, and even Wicket and they were both so fast you wouldn't think it even went to the server...

                • 5. Re: Writing fast A4J Pages

                  P.S. in terms of time I'm talking about adding 1 row to a 20 row table. each row has 3 columns of input. Now I know it's not the inputs because I'm doing ajaxsingle and even immediate=true, and it takes half a second to add the row, not over network just on localhost.

                  • 6. Re: Writing fast A4J Pages
                    nbelaevski

                    Have you checked with profiler where time is spent?