5 Replies Latest reply on Apr 9, 2010 3:45 AM by Ilya Shaikovsky

    Panel menu item selected problem

    jsf geeks Master

      hi everyone

      in my Application i am using Panel menu,panel menu group and  panel menu item for listing list and sublist.

      i have achived that dynamically through Java Class like below.



      if (null == biomenu) {
                                  biomenu = (HtmlPanelMenu) app.createComponent(HtmlPanelMenu.COMPONENT_TYPE);
                              HtmlPanelMenuGroup pnlgrpstd = (HtmlPanelMenuGroup) app.createComponent(HtmlPanelMenuGroup.COMPONENT_TYPE);
                              pnlgrpstd.setId("pnlmenugrp" + rs_tpview.getString("id"));
                              sel_chap = query;
                              rs2_tpview = stmt1_tpview.executeQuery(sel_chap);
                              if (con != null && rs2_tpview != null) {
                                  while (rs2_tpview.next()) {

                                      if (rs_tpview.isFirst() && rs2_tpview.isFirst()) {
                                          current = rs2_tpview.getObject("id");
                                      if (rs2_tpview.isFirst()) {
                                          UIParameter pnlstdpara = (UIParameter) app.createComponent(UIParameter.COMPONENT_TYPE);
                                          pnlstdpara.setId("pnlmenuitmfprmchap" + rs2_tpview.getString("id"));
                                      HtmlPanelMenuItem phymenuitmchap = (HtmlPanelMenuItem) app.createComponent(HtmlPanelMenuItem.COMPONENT_TYPE);
                                      phymenuitmchap.setId("pnlmenuitm" + rs2_tpview.getString("id"));
                                      UIParameter pnlchappara = (UIParameter) app.createComponent(UIParameter.COMPONENT_TYPE);
                                      pnlchappara.setId("pnlmenuitmfprm" + rs2_tpview.getString("id"));
                                      Class[] params = {};
                                      MethodExpression actionExpression = app.getExpressionFactory().createMethodExpression(ctx.getELContext(), "#{contentlist.chapterlist_action}", String.class, params);


                              Class[] params1 = {};
                              MethodExpression actionExpression1 = app.getExpressionFactory().createMethodExpression(ctx.getELContext(), "#{contentlist.std_action}", String.class, params1);


                               AjaxContext ac = AjaxContext.getCurrentInstance();



      <rich:simpleTogglePanel  opened="#{contentlist.search_found==false}"  rendered="#{contentlist.current_subject==1}"  id="smpltglpnl_stdchaplst_bio" style="left:2px;top:35px;position:absolute;width:280px;height:725px;overflow:auto;" switchType="client" >
                                  <f:facet name="header">
                                      <h:outputText id="pnlbio_hd"   value="#{rich:findComponent('btn_bio').value}"/>
                                      <h:outputText value="#{contentlist.current}"/>
                                  <rich:panelMenu width="255px" selectedChild="#{contentlist.current}" expandSingle="true" binding="#{contentlist.biomenu}" id="biomenu" expandMode="ajax" iconExpandedTopGroup="chevronUp" iconCollapsedTopGroup="chevronDown">

      I have three buttons and one dropdown for filter purpose so when one click on particular button Panel menu content changes.and first sublist(menu item) get highlighted,

      but when i click on one of list(PanelMenuGroup) then it's first(sublist-panel menu item) won't get highlighted any idea?


      like on above image i click on mechanics it's first value get selected!!!!!1

        • 1. Re: Panel menu item selected problem
          Ilya Shaikovsky Master

          not sure that get correctly :/ So on initial rendering(after pmenu constructed) - selectedChild works ok, but after you clicking to menu - it doesn't changed?


          P.S. binding object scope?

          • 2. Re: Panel menu item selected problem
            jsf geeks Master


            thank you very much!!!!

            actually my page scope is session like below


            i am also adding Panel menu to ajax context like below

            AjaxContext ac = AjaxContext.getCurrentInstance();

            but still not successfull.

            • 3. Re: Panel menu item selected problem
              Ilya Shaikovsky Master

              actually session scoped JSF component bindigs could cause many problems..


              And what about my question, does just further selections after initial rendering not working?

              • 4. Re: Panel menu item selected problem
                jsf geeks Master


                sorry i forgot to answer your question.

                Actually When panle menu intially constructed it's first panel menu group's first panel menu item is selected.

                And Even when i click on filter buttons and drop  down to filter it's get selected as i am reconstructing the whole menu on button action event and drop down process value change.

                Problem arises when i clcik on particular menu group so it expanded and it's menu items displayed but it's first menu item wont get selected. at this time i not reconstructing the whole menu i think that might be the problem.

                i have set expandSingle="true"

                • 5. Re: Panel menu item selected problem
                  Ilya Shaikovsky Master

                  Seems got your point. Actually only one item or group is selected in pmenu(that's why attribute called selecvted child - it could be either some item or some group). Selection is not bubled to top - it means if the item selected - parent group is not getting this state visuall. And the same for group if the group selected - nothing gets selected inside. So unfortunatelly seems you need to set expand mode ajax and manage selected child in listener so when node opened - selection became set to it's child.