7 Replies Latest reply on Jul 5, 2012 2:27 PM by sansaric

    How to update a specific row or cell in an extendedDataTable using the render property

    sansaric

      I am trying to update a specific row or cell in an extendedDataTable using the render property of an action outside the table, but I can't seem to get it to work. I followed instructions found in the following page http://docs.jboss.org/richfaces/latest_4_0_X/Component_Reference/en-US/html/chap-Component_Reference-Tables_and_grids.html#sect-Component_Reference-a4jrepeat-Limited_views_and_partial_updates which indicate to use render=tableId:#{@rows(bean.rowToUpdate)}:cellId for actions outside the table but I get a parsing error.

      I specifically used render="JobStatusTable:#{@rows(jobStatusManagementBean.tableRowsToUpdate)}". I am using RichFaces 4.2.2 on Tomcat 6.0.18 and made sure that EL libs el-api-2.2.0.jar and el-api-2.2.0.jar are in my context lib directory and my web.xml has to following entry to meet EL requirements for JSF Sun RI (using version javax.faces-2.1.10.jar)

           <context-param>

              <param-name>com.sun.faces.expressionFactory</param-name>

              <param-value>com.sun.el.ExpressionFactoryImpl</param-value>

          </context-param>

       

      Any suggestion would appreciated,

       

      Thanks,

       

      Marc

        • 1. Re: How to update a specific row or cell in an extendedDataTable using the render property
          healeyb

          I use a syntax like this render="tableId:@rows(bean.rowToUpdate):cellId" and it works ok for me.

           

          Regards,

          Brendan.

          • 2. Re: How to update a specific row or cell in an extendedDataTable using the render property
            iabughosh

            Hello Marc,

            unfortunately, that documentation contains some errors, anyway you correct syntax is like this :

            render="JobStatusTable:@rows(jobStatusManagementBean.tableRowsToUpdate):componentId"

             

            where conponentId is an id for component under a specific column.

             

            regards.

            • 3. Re: How to update a specific row or cell in an extendedDataTable using the render property
              sansaric

              Thank you Brendan and Ibrahim for your responses. I will try the syntax that you suggested and hopefully will get good results. The documentation says that the @rows function acceptts a collection of row keys to be updated. What exactly are you passing to the rows function ? Possibly a set containing one or more Integers indicating which row(s) to update.

               

              Thanks,

               

              Marc

              • 4. Re: How to update a specific row or cell in an extendedDataTable using the render property
                healeyb

                Yes, just a List<Integer> will do the job.

                 

                Regards,

                Brendan.

                • 5. Re: How to update a specific row or cell in an extendedDataTable using the render property
                  sansaric

                  Thanks Brendan. I tried it and it works. I was hoping that I could also update an entire table row in case an action is affecting multiple cells by ommiting the :cellid in render="tableId:@rows(bean.rowToUpdate):cellId". However, it does not work. I suppose I am limited to specifying each affected cells in the render statement.

                   

                  Regards,

                   

                  Marc

                  • 6. Re: How to update a specific row or cell in an extendedDataTable using the render property
                    healeyb

                    Ok, well if it doesn't work it's a shame, but a good candidate for an enhancement request.Presumably you will have to use a syntax

                    like this to update multiple cells:

                     

                    render="tableId:@rows(bean.rowToUpdate):cellId1 tableId:@rows(bean.rowToUpdate):cellId2 ..." - not good, so it would be nice to

                    have a few options:

                     

                    1. render="tableId:@rows(bean.rowToUpdate)" - the whole row. The problem is what is a whole row in terms of component ids? given

                        that the JSF table structure is column based and not row based. Not sure that this will fly.

                     

                    2. render="tableId:@rows(bean.rowToUpdate):(cellid1 cellid2)" - or something along those lines, certainly saves some typing.

                     

                    Given that you can normally supply an EL expression with a string of component ids, presumably you can still do it in this scenario,

                    but I wonder how it would work. Perhaps like this: render="tableId:@rows(bean.rowToUpdate):bean.idsToUpdate", but I suspect

                    not, or maybe render="tableId:@rows(bean.rowToUpdate):#{bean.idsToUpdate}", or maybe you'd just have to have

                    render="#{bean.rowsAndIdsUpdateMatrix} which evaluates to the full length

                    "tableId:@rows(bean.rowToUpdate):cellId1 tableId:@rows(bean.rowToUpdate):cellId2

                     

                    If you do any more work on this I'd be interested to know which (if any) of these work.

                     

                    Regards,

                    Brendan.

                    • 7. Re: How to update a specific row or cell in an extendedDataTable using the render property
                      sansaric

                      Thanks again Brendan for all your help and suggestions.

                       

                      render="tableId:@rows(bean.rowToUpdate):cellId1 tableId:@rows(bean.rowToUpdate):cellId2" definitely works, however as you said, it gets too cumbersome as the number of columns to update increases.

                       

                      Suggestion # 1. render="tableId:@rows(bean.rowToUpdate)" doesn't work but would be my favorite way of handling it as an enhancement, but maybe impossible due to the JSF table structure based on columns

                       

                      I will try some of the other possibilities and reply if any of them yields positive results. In the mean time, I probably will keep updating the entire table when many columns required updating.

                       

                      Regards,

                       

                      Marc