6 Replies Latest reply on Dec 29, 2008 9:32 AM by eldariel

    PanelMenu target not working

    eldariel

      Hi there,

      we want to start using RichFaces in our web applications. I'm currently building an example application for my department using most of the needed components and creating our own styleguide. Right now I'm desperately stuck and need some help. I'm sorry for asking but I've been stuck for a while with that topic now.

      I am trying to build a panelMenu to get the main navigation done. Everything works well aside the target attribute. I just can't get the damn menu to use another frame to execute the action. For CommandLinks I got it to work with setting the target attribute of the form via javascript before executing the action (even if I kind of hate that workaround). The same approach doesn't work for the panelMenu since it doesn't need a form.

      Am I doing something wrong here or is it a bug? If so is there a workaround?

      a simplified snippet of my backing bean:

      ...
      private HtmlPanelMenu _navigationPanelMenu = null;
      ...
       FacesContext facesContext = FacesContext.getCurrentInstance();
       Application application = facesContext.getApplication();
      
       String target = "content";
      
       _navigationPanelMenu = new HtmlPanelMenu();
       _navigationPanelMenu.setLabel("Portal");
      
       Class[] params = {};
       MethodExpression actionExpression = application.getExpressionFactory()
       .createMethodExpression(facesContext.getELContext(),
       "gotoBlubb", String.class, params);
      
       HtmlPanelMenuGroup group;
       HtmlPanelMenuItem item;
      
       group = new HtmlPanelMenuGroup();
       group.setLabel("DefDokuTool");
       group.setActionExpression(actionExpression);
       group.setTarget(target);
      
       item = new HtmlPanelMenuItem();
       item.setLabel("Sparten");
       item.setActionExpression(actionExpression);
       item.setTarget(target);
       group.getChildren().add(item);
       _navigationPanelMenu.getChildren().add(group);
      ...
      


      that's how my tag looks like:
      <rich:panelMenu id="navigationPanelMenu" style="width:140px"
       mode="ajax"
       binding="#{userBean.navigationPanelMenu.navigationPanelMenu}"
       value="item"
       selectedChild="#{userBean.navigationPanelMenu.selectedChild}"
       iconExpandedGroup="disc" iconCollapsedGroup="disc"
       iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
       iconCollapsedTopGroup="chevronDown">
       </rich:panelMenu>
      


      I'm using the sun JSF implementation 1.2.07, richfaces 3.2.2.sr1, jstl 1.2

      Actually I'd prefer to use css fixed positioning instead of frames. Is there maybe another way how to get a behaviour like frames done with css fixed positioning while still being able to use the jsf navigation rules?

        • 1. Re: PanelMenu target not working
          shadowcreeper

           

          "eldariel" wrote:
          Actually I'd prefer to use css fixed positioning instead of frames. Is there maybe another way how to get a behaviour like frames done with css fixed positioning while still being able to use the jsf navigation rules?

          You could try a layout manager such as the xilinus simple layout manager or dojo's dijit.layout.BorderContainer...

          • 2. Re: PanelMenu target not working
            eldariel

            Thanks for the advice. I had a quick look at the layout managers but I still don't see how I would be able to still use the standard JSF navigation rules to navigate since I don't know how to get the content I load to show up in specific sections of my layout.

            With frames that should be possible with the target attribute which I can't get to work. As soon as I try using divs I'm at a complete loss. The only thing I could think of to achieve my goal with divs is writing my own navigation handler ignoring the navigation rules alltogether which I want to avoid if possible.

            • 3. Re: PanelMenu target not working
              shadowcreeper

              It's not as complicated as you are thinking. That's what the reRender attribute of all this ajax stuff is for.

              • 4. Re: PanelMenu target not working
                eldariel

                yes, I can use the reRender to update certain parts of a page while maintaining in the background what exactly should be displayed there. But that would force me to write my own navigation handler.

                It might not be that difficult but I can't get myself to reinvent the wheel that easily. A lot of people using JSF should have that problem if they need flexibility not only in their content but in their navigation as well. So everyone who wants the flexibility JSF offers in theory needs to rewrite the whole navigation part? Is that really my only option or am I missing an important point here? Is there no way to do it by using the standard navigation? Actually I like it pretty much...

                Sorry for bothering, after all I'm still quite new to JSF and need to learn a lot more but I can't find any satisfying information on this on the web.

                • 5. Re: PanelMenu target not working
                  nbelaevski

                  Hi,

                  Try to use 'server' instead of 'ajax'.

                  • 6. Re: PanelMenu target not working
                    eldariel

                    @nbelaevski: ok, I just love you! ^^

                    I only tried client and ajax but didn't even try server mode... I can't believe it was that obvious... Thanks for the help :) and sorry for bothering...