5 Replies Latest reply on Feb 10, 2009 11:07 AM by imkookoo

    Columngroup re-rendering

    imkookoo

      I'm aware that you cannot rerender a columnGroup, so I'm hoping to get a solution for the following. I have a sortable table as such:


      --------------------------------
      | info1 | info2 | info3 | Click |
      ---------------------------------
      | DETAILS |
      ---------------------------------


      The DETAILS portion contains info for the particular row and should only show when you click on "Click".

      My current datatable does do this, and it works:

      
       <rich:dataTable id="dataTable" ajaxKeys="#{rowsToUpdate}" value="#{rows}" var="row">
      
       <rich:column> ... </rich:column>
       <rich:column> ... </rich:column>
       <rich:column> ... </rich:column>
       <rich:column> <a4j:outputLink action="#{showDetails}" reRender=""dataTable"/> </rich:column>
      
       <rich:columnGroup rendered="#{row.showDetails}">
       <rich:column id="detailsRow" colspan="7" >
       DETAILS
       </rich:column>
       </rich:columnGroup>
       </rich:dataTable>
      



      However, it works by reRendering the whole datatable. (As a side question, is it intended that the whole datatable rerenders despite specifying specific rows to update in ajaxKeys?)

      Anyway, I want to reRender only the row clicked on cause the table can be pretty long. So, instead of rerendering "dataTable", I would like to reRender just the details portion.

      I've tried reRendering the columnGroup, which I just found out you can't do. And I tried reRendering the column inside the columnGroup, which also doesn't work.

      Any recommendations?

      Thank you.

        • 1. Re: Columngroup re-rendering
          ilya_shaikovsky

          reRendering the conditionally rendered elements restricted. Because changing rendered=false to true by ajax caused the framework trying to update elements which isn't present in DOM. And columnGroup tag which parent to columns in JSF tree has no representation in DOM also. So seems no suitable solution for you.

          • 2. Re: Columngroup re-rendering
            imkookoo

             

            "ilya_shaikovsky" wrote:
            reRendering the conditionally rendered elements restricted. Because changing rendered=false to true by ajax caused the framework trying to update elements which isn't present in DOM. And columnGroup tag which parent to columns in JSF tree has no representation in DOM also. So seems no suitable solution for you.


            Oh ok.. Thank you.

            I just thought of a solution, tested it, and it worked. It basically involves updating the CSS rather than the rendered attribute. Basically, change the code above to:

            <rich:dataTable id="dataTable" ajaxKeys="#{rowsToUpdate}" value="#{rows}" var="row">
            
             <rich:column> ... </rich:column>
             <rich:column> ... </rich:column>
             <rich:column> ... </rich:column>
             <rich:column> <a4j:outputLink action="#{showDetails}" reRender="
            detailsRow
            "/> </rich:column>
            
             <rich:columnGroup>
             <rich:column id="detailsRow" colspan="7" style="row.showDetails == true ? '' : 'display:none'">
             DETAILS
             </rich:column>
             </rich:columnGroup>
             </rich:dataTable>
            
            
            


            • 3. Re: Columngroup re-rendering
              imkookoo

              Whoops... made a mistake above. "row.showDetails == true ? '' : 'display:none'" should of course be in an EL Expression bracket: #{...}

              • 4. Re: Columngroup re-rendering
                ilya_shaikovsky

                but in this case - the details will be already at client and should be just shown.. And seems no matter to use additional ajax request.

                • 5. Re: Columngroup re-rendering
                  imkookoo

                   

                  "ilya_shaikovsky" wrote:
                  but in this case - the details will be already at client and should be just shown.. And seems no matter to use additional ajax request.


                  I don't want the details to be shown by default since that would make the page way too long. What I'm additionally doing though, to reduce load, is wrapping the DETAILS portion in a panelGroup and then putting the rendered attribute on the panelGroup.

                  So basically:

                   <rich:columnGroup>
                   <rich:column id="detailsRow" colspan="7" style="#{row.showDetails == true ? '' : 'display:none'}">
                   <h:panelGroup rendered="#{row.showDetails == true}">
                   DETAILS
                   </h:panelGroup>
                   </rich:column>
                   </rich:columnGroup>