2 Replies Latest reply on Oct 18, 2007 12:37 PM by ronanker

    Switch TabPanel from Ajax to Client switch type

    rconaway

      I've got a difficult requirement to satisfy. I'm hoping someone might be able to give me some ideas. I am fairly new to JSF and RichFaces, but I'm getting a pretty good sense of the way it wants to work. I have not dug around in the internals yet.

      I have a tab panel with 8 tabs, each of them showing different types of information about a claim. Typically, a user would spend some time finding the claim then land on this tab panel to research within the claim's data for a while. They may view just the front tab or they may view all of the tabs.

      I need to download each tab as it is viewed. But once it has been viewed once, I want the client to remember what was downloaded so it doesn't have to do a server hit again. It's ok to sustain the network latency the first time a tab is shown, but we don't want the user to have to wait for the network as they switch around between already-viewed tabs. And we don't want to wait for all the tabs to be downloaded at the beginning.

      A solution might be to change the switchtype of each tab as it is rendered the first time. It is "AJAX" initially so it doesn't render until the tab is actually viewed. But switch to "CLIENT" after the first view so it stays on the client. I don't think this is possible, I only mention it as another way of describing what I'm trying to do.

      Does anyone have any suggestions? I'm using a tabPanel with "AJAX" switchtype as the closest approximation I can think of. But I'm open to any suggestions that satisfy the requirements.

      Rob



        • 1. Re: Switch TabPanel from Ajax to Client switch type

          Try something like

          <rich:tab switchType="#{bean.currentTabXYSwitchType}>
          
          </rich:tab>
          


          and now you only have to get the right moment to switch that in the bean. This is a typical problem because at first glance the oncomplete attribute seems to be a solution but on second you realize that you can't communicate with you bean with a javascript call.

          I hope some expert will say something to this problem, but here another you can try:

          1.) Do as told above but make
          2.) Set a boolean value 'myTabXYwasCalled' in getCurrentTabXYSwitchType to true.
          3.) Use a poll that calls a method that checks (for all Tabs) if they were called and change in that case the switchType variable in the bean.


          • 2. Re: Switch TabPanel from Ajax to Client switch type
            ronanker

            developping a new attribute for the component named 'memory' for exemple, and when 'true' act like you said, memorizing what has been already loaded.
            this can be fine...

            or new value for 'mode':
            -Server
            -Ajax
            -AjaxMemory
            -ProgressiveClient
            -Client

            with ProgressiveClient means that it loads other tabs in backGround after the first load of the page but before the user clics on them...