2 Replies Latest reply on Sep 12, 2007 6:53 AM by Jim Dummy

    rich:simpleTogglePanel inside a4j:repeat

    Jim Dummy Newbie

      Hello!

      I have a bunch of simpleTogglePanel panels inside a a4j:repeat.

       <table id="search_table" cellspacing="0" cellpadding="0" style="width: 100%; padding: 4px 4px 4px 4px; border: 0px solid transparent">
       <a4j:repeat
       value="#{SearchForm.results}"
       ajaxKeys="#{SearchForm.rowKeys}"
       var="result">
      
       <tr style="width: 100%">
       <td>
       <a4j:outputPanel id="item">
       <rich:simpleTogglePanel
       label="#{result.description}"
       switchType="client"
       ajaxSingle="true"
       opened="false"
       rendered="#{!result.void}">
       <rich:dataTable value="#{result.resultList}" var="r" style="width: 100%">
       <rich:column>
       <a4j:outputPanel style="width: 100%; height: 150px; overflow: auto; padding:2px;" layout="block">
       <h:outputText value="#{result.htmlMap[r]}" style="width: 100%; height: 100%; text-align: left" escape="false"/>
      
       </a4j:outputPanel>
       </rich:column>
       </rich:dataTable>
       </rich:simpleTogglePanel>
       </a4j:outputPanel>
      
       </td>
       </tr>
       </a4j:repeat>
       </table>
      


      every second <a4j:outputPanel id="item"> is reloaded checking if we have a result for the row (rendered="#{!result.void}")

      the problem is that by default the simpleTogglePanel is set to [opened="false"], but when it reloads it's state depends of the LAST updated simpleTogglePanel!!!

      I mean that if the last updated (reRendered) simpleTogglePanel is "opened" then new updated is opened too! (???)

      Has it something common with http://jboss.com/index.html?module=bb&op=viewtopic&t=114226?

      Which is a my case too.

      I have put my jboss to the public url - http://inb.bsc.es/gn6/index.jsf

      goto: [search] tab then enter "1pio" as a search string and push "search"

      Thank you in advance.

        • 1. Re: rich:simpleTogglePanel inside a4j:repeat
          Jim Dummy Newbie

          Anybody home? :-)
          Just kidding...

          Not able to find a solution to my problem I went further and added a scroller into my datatable. I have:

          <a4j:repeat
           <rich:simpleTogglePanel
           <rich:datascroller>
           <rich:dataTable
          


          So now not only ALL togglePanels opened/closed by a click, but also tables inside the toggle scrolled synchronously. I mean that if I had two toggles and each of them has scroller/table and I scroll one table - another is "perfectly" scrolled too...

          Tested with RC6

          Thank you again.

           <rich:tabPanel switchType="ajax">
           <rich:tab label="Query Result" style="padding: 0px 0px 0px 0px;">
           <a4j:outputPanel id="search_list">
          
           <table id="search_table" cellspacing="0" cellpadding="0" style="width: 100%; padding: 4px 4px 4px 4px; border: 0px solid transparent">
           <a4j:repeat
           value="#{SearchForm.results}"
           ajaxKeys="#{SearchForm.rowKeys}"
           var="result">
          
           <tr style="width: 100%">
           <td>
          
           <a4j:outputPanel id="item">
           <rich:simpleTogglePanel
           label="#{result.description}"
          
          
           switchType="ajax"
           ajaxSingle="true"
           opened="false"
          
           rendered="#{not empty result && !result.void}">
          
           <a4j:outputPanel id="multy_table">
           <rich:datascroller for="multy_result"/>
           <rich:spacer height="30" />
           <rich:dataTable id="multy_result" value="#{result.resultList}" var="r" rows="#{result.preferredPageSize}" style="width: 100%">
           <rich:column>
           <a4j:outputPanel style="width: 100%; height: 150px; overflow: auto; padding:2px;" layout="block" rendered="#{not r.simple}">
           <h:outputText value="#{r.html}" style="width: 100%; height: 100%; text-align: left" escape="false"/>
           </a4j:outputPanel>
          
           <h:outputText value="#{r.nameSpace} = #{r.id}" style="width: 100%; height: 100%; text-align: left" rendered="#{r.simple}"/>
           </rich:column>
           </rich:dataTable>
           </a4j:outputPanel>
           </rich:simpleTogglePanel>
           </a4j:outputPanel>
          
           </td>
           </tr>
           </a4j:repeat>
           </table>
           </a4j:outputPanel>
           </rich:tab>
          


          • 2. Re: rich:simpleTogglePanel inside a4j:repeat
            Jim Dummy Newbie

            Hello!

            The problem is in ajaxKeys="#{SearchForm.rowKeys}"
            Even if I return all keys (Set [0, 1 ...]) bad things happen.

            I suppose that returning ALL the keys should be the same as if there is no ajaxKeys at all?

            When there is no ajaxKeys attribute everything is ok.

            Could anyone clarify it?

            Pleeease.