10 Replies Latest reply on Oct 10, 2012 4:43 AM by ugossi

    How to reRender specific row in richfaces 4

    ugossi

      Hi All, i spent a lot of time for resolving the question in the of rendering a specific row of a datatable in richfaces 4.

      I'm able to do in richface 3.3 using ajaxKeys="....", but i'm not able to resolve the problem in richfaces 4.

      I have a data table where a ican select a row. The data related to the row will be visualizzed in a popup panel. The user could modify the data, save it and then close the pop up.

      On close popup event i wolud like to render the selected row of the table.

      I try with render="tableId:@rows(bean.rowToUpdate):cellId", but i haven't understand very well.

      Someone may suggest me something? :-)

      Thanks!!

        • 1. Re: How to reRender specific row in richfaces 4
          just-greg

          Can we see the actual xhtml that you are trying to use?

          • 2. Re: How to reRender specific row in richfaces 4
            healeyb

            You're basically there, you just need to know that with bean.rowToUpdate rowToUpdate is a List<Integer> of row ids.

            If you are using an ExtendedDataModel your implementation of the abstract class needs to implement a few "extra

            bits" but I can't remember what off the top of my head.

             

             

             

            Regards,

            Brendan.

             

             

             


            Java Enterprise Developer


            JSF Richfaces Ajax Java 6/7 (scjp) EE 6 HTML CSS JavaScript jQuery MySQL JPA Hibernate Eclipselink

            Spring Oracle SQL JPQL Sybase EJB CDI Glassfish Apache JAX-RS Primefaces UNIX Paypal and more..

            • 3. Re: How to reRender specific row in richfaces 4
              ugossi

              My code is like:

               

              <h:form id="form1">

               

              ....

               

               

              <

              rich:dataTable id="tabLab" value="#{BB.listLab}"

               

              rows="8" var="lb" rowClasses="odd-row, even-row">

              <

              rich:column width="50" style="text-align:center;white-space: nowrap;font-size:medium;"

              >

               

               

               

               

               

               

               

               

               

               

               

              <f:facet name="header">

               

              <h:outputText value="Codice" style="font-size:medium"/>

               

              </f:facet>

               

              <h:outputText value=" #{lb.codice}" />

               

              </rich:column>

               

              <rich:column width="50" style="text-align:left;white-space: nowrap;font-size:medium;" id="descr">

               

              <f:facet name="header">

               

              <h:outputText value="Descrizione" style="font-size:medium"/>

               

              </f:facet>

               

              <h:outputText value=" #{lb.descrizione}"/>

               

              </rich:column>

              </

               

              rich:dataTable>

              ....

              </h:form>

              ....

               

              <

              h:form id="form2">

              ....

              <

              rich:popupPanel id="popup" modal="true" autosized="true" resizeable="false" height="360" width="500" domElementAttachment="form">

              ..

               

               

              <

              X

               

              </a4j:commandLink>

              ....

              </h:form>

               

               

               

              a4j:commandLink id="closePanel" actionListener="#{BB.chiudiPop}" render="tabLab:@rows(BB.keysSet):descr" oncomplete="#{rich:component('popup')}.hide();">

               

               

              private

              Set<Integer> keysSet

              ;

               

              public

              Set<Integer> getKeysSet() {

               

              return keysSet

              ;}

               

              public void

              setKeysSet(Set<Integer> keysSet) {

              System.

              out.println("setKeysSet: "

              +keysSet);

               

              this.keysSet

              = keysSet;}

               

               

              But i think i miss something.

              Regards.

              • 4. Re: How to reRender specific row in richfaces 4
                iabughosh

                set your id to your h:outputText not to h:column.

                 

                regards,

                • 5. Re: How to reRender specific row in richfaces 4
                  ugossi

                  Hi Ibrahim, thanks for the suggestion. I put the id on the outputText

                  <ey

                   

                  h:outputText value=" #{lb.descrizione}" id="descr"/>

                  but i have the same problem, when i close the popup nothing happens.

                   

                  I also try to add in the action of the close event, (actionListener="#{BB.chiudiPop}")  this code for updating the set of rows index

                   

                  keysSet.clear

                  keysSet.add((ind) idTmp);

                   

                  where idTmp contains the index of the selected row.

                   

                   

                  • 6. Re: How to reRender specific row in richfaces 4
                    healeyb

                    I just made this note to myself, don't know if it's any help but I recall that I got it working when

                    I realised how the client id was put together after looking at the page source...

                     

                    When rendering a specific cell in a pageable extendedDataTable using the syntax:

                         render="topiclist:@rows(messageBoardView.updateItems):viewcount"

                         the updateItems ArrayList contains the id (persistent id) of the entity as

                         supplied by dv.process(ctx, getKey(t), argument) in RichLazyDataModel.

                         In other cases it might be the row index, use browser dev tools to look at

                         the client id, row index will start from 0.

                    • 7. Re: How to reRender specific row in richfaces 4
                      just-greg

                      Have you tried with the popup being in the same <h:form> ?

                      • 8. Re: How to reRender specific row in richfaces 4
                        ugossi

                        Ok, some small improvement...now i'm able to rerender one cell of the table.

                        Using

                        render="form1:tabLab:#{BB.riga}:descr"

                        Adding

                        <rich:dataTable id="tabLab" value="#{BB.listLab}"

                        rows="8" var="lb" rowClasses="odd-row, even-row" rowKey="riga">

                         

                        I try to rendere the entire row, using

                         

                        render="form1:tabLab:#{BB.riga}

                         

                        but in this case nothing happens.

                        • 9. Re: How to reRender specific row in richfaces 4
                          iabughosh

                          unfortunately, you can't render the entire row because of limitation with RF 4, you can render multiple cells instead.

                           

                          regards.

                          • 10. Re: How to reRender specific row in richfaces 4
                            ugossi

                            Hi Ibrahim,

                            i find this post in the forum https://community.jboss.org/message/20164. where i read

                             

                            "....render="tableId:rowKey" or render="tableId:#{controller.rowKeysSet}" shoud be used for updates for the whole rows...."

                             

                            I try this solution, but dosen't work! May be a future development?

                             

                            Thanks.

                            Regards.