2 Replies Latest reply on Aug 5, 2011 9:15 AM by Andriy Pashkevych

    Extending TabPanel to add lazy loading attribute.

    Andriy Pashkevych Newbie

      Hello!

       

      I need to modify TabPanel component, to add a custom attribute, for example <rich:tabPanel id="customPanel" lazy="true | false" ... and to be able to decide if the tab content should be reloaded from the server basing on the value of that property.

       

      Just to clarify: if the property is set to false, the tab content should be loaded only once.

       

      Thanks in advance!

        • 1. Re: Extending TabPanel to add lazy loading attribute.
          Andriy Pashkevych Newbie

          I've got an idea... but I am not sure if it is possible to implement.

           

          What if I change the tab swtichtype to "client" at the moment it gets encoded?

          Is it possible to change switchType attribute at runtime?

           

          Any suggestions are highly appreciated.

          • 2. Re: Extending TabPanel to add lazy loading attribute.
            Andriy Pashkevych Newbie

            In order to make the tabs encoded only once I have done the following:

             

             

            I have changed the TabPanelRenderer in a way that it sets switchType="client" for each tab that gets encoded for the first time (so all the next times it is clicked - event is handled on the client).


            It works fine, except one thing, when the tab with switchType="ajax" (the one that hasn't been clicked before) is clicked - all the other tabs (even those with switchType="client" are encoded).

             

            Is it possible to prevent tabs with switchType="client" from being encoded, in other words to make them hold the state on the client, when tab with switchType ajax is clicked?