0 Replies Latest reply on May 17, 2008 6:58 AM by Vladimir Kovalyuk

    rich:tabPanel and true lazy loading on tabs

    Vladimir Kovalyuk Apprentice

      A page has 2 tabs on tabPanel as follows:

      <rich:tabPanel switchType="server" selectedTab="#{detailsPage.selectedTab}" width="100%">
       <rich:tab id="general" label="General"/>
       <rich:tab id="extra" label="Extra">
       <rich:dataTable value="#{detailsPage.extraData}">
       ...
       </rich:dataTable>
       </rich:tab>
      </rich:tabPanel>
      

      When page is rendered DetailsPage.getExtraData() method is called even if the first page is selected. To avoid unnecessary fetching of data I use c:if.
       <rich:tab id="extra" label="Extra">
       <c:if test="#{detailsPage.selectedTab eq 'extra'}"
       <rich:dataTable value="#{detailsPage.extraData}">
       ...
       </rich:dataTable>
       </c:if>
       </rich:tab>
      


      Do you like it? I don't. So I'm wondering whether it is possible not to include invisible pages into JSF component tree?

      And similar problem exists with "rendered" attribute. Although it is evaluated as FALSE its inner subtree is still evaluated (and sometimes produces inobvious errors). Here c:if comes in handy but the page code looks cumbersome as the above or even worse.