6 Replies Latest reply on Jul 10, 2007 10:11 AM by carlhowarth

    reRender dynamic rich:tabpanel

      Hello there,

      I am dynamically creating a rich:tabpanel within an app. Each tab represents a list of data - I want to provide functionality to delete a list and rerender the tab panel without the deleted tab.

      In the code I set the bound tabpanel variable to be a new HtmlTabPanel() then regenerate the dynamic tabs, however the get method of the tab panel is not being called, ergo the panel is not rerendered on my page. I have tried rerendering the client id of the tabpanel, and have also tried surrounding it in an a4j:outputpanel with ajaxRendered="true" but unfortunately this hasn't worked.

      Can anyone help at all please?

      Kind regards, Carl

        • 1. Re: reRender dynamic rich:tabpanel

          Hello again,

          I have tried using a standard command link and unfortunately the tabs are not re-rendered as I would expect then either.

          The getter of the bound object is not being called at all. If I set the tab panel to be transient it does get called, but that is no use to me as the actionlisteners within the tabs then stop functioning.

          Please can anybody offer advice?

          Thanks in advance, Carl

          • 2. Re: reRender dynamic rich:tabpanel

            Sorry to be a pain in persisting with this but I'm working to a deadline. If the tabpanel simply cannot be rerendered to add/remove tabs dynamically I will need to rethink the UI design somewhat.

            Any ideas to get this working would be gratefully received.

            Cheers!

            • 3. Re: reRender dynamic rich:tabpanel
              ilya_shaikovsky

              Sorry for the delay.. Please provide the code you've created for review please.

              • 4. Re: reRender dynamic rich:tabpanel

                Thanks for the reply - it's a bit difficult to provide all the code; I'll try to provide a better synopsis.

                I have a tab panel (that happens to be within a tab of another tabpanel, thus:

                <rich:tabPanel headerAlignment="right" switchType="client" id="candidatelisttabs" binding="#{mybean.listTabPanelUI}"/>


                When the parent tab is selected, an action listener is fired causing the tabs to be populated:

                public void generateLists(ActionEvent ev) {
                 if (_listTabPanelUI.getChildren().isEmpty()) {
                 //_listTabPanelUI.setTransient(true);
                 _log.debug("Generating list tabs");
                 short i = 0;
                 for (CandidateList list : getCandidateListMap().values()) {
                 HtmlTab tab = new HtmlTab();
                 tab.setLabel(list.getName());
                 tab.setName(list.getName());
                 tab.setId(createUniqueIdMethod());
                 populateDynamicTab(tab, i);
                 _listTabPanelUI.getChildren().add(tab);
                 i++;
                 }
                 }
                 }


                The populateDynamicTab method is a little long to provide, but it is working and the tabs are being generated as expected.

                Now, from within the dynamically generated tabs I provide a method to delete the object, in this case the 'CandidateList'. The tab is being deleted from the parent collection, then I have tried both
                _listTabPanelUI.getChildren().clear()
                and
                _listTabPanelUI = new HtmlTabPanel()
                after which I call the generateLists() method, expecting the dynamic tab panel to be rerendered on the page, less the deleted tab.

                I have put a logger on the get method of the _listTabPanelUI object and it is not being called. The commandbutton used to call the delete method has a rerender property of the tab panel in the format 'formname:candidatelisttabs' and I have also tried surrounding the tabpanel with an a4j:outputPanel, using ajaxRendered=true with layout=block.

                The components within the tabs appear to be rerendered, but the tabs themselves are not. As mentioned earlier, if I setTransient(true) on the tab panel when I create it, the tab panel does get rerendered as I would expect, though the action listeners within the tab stop functioning.

                I really hope there is a way to get this working, as it looks exactly as I want it to!

                Thanks, Carl

                • 5. Re: reRender dynamic rich:tabpanel

                  Has the last post been any use in clarifying my issues at all? Please let me know if you require further information.

                  • 6. Re: reRender dynamic rich:tabpanel

                    Hi Guys,

                    I have solved this (I think). Regenerating the tabs from scratch will not work, however if I remove the tab from the tabpanel's collection of children it does work. Happy days!