8 Replies Latest reply: Sep 29, 2008 7:35 AM by PaKo RSS

    displaying pop up on click of commandMenuItem

    629225
      Hello,

      I wan to display popup window when I click on commandMenuItem

      <af:popup binding="#{backing_showData.delPopup}" id="delPopup">

      <af:commandMenuItem text="Item One"
      binding="#{backing_showData.deleteRow}"
      partialTriggers="logTable" action="#{backing_showData.moveAction}"
      id="deleteRow"
      disabled="#{!bindings.Delete.enabled}"/>

      <af:clientListener method="loadItem" type="click"/>

      </af:commandMenuItem>

      I am calling client listener to show pop up , this function get called and popup component is there on the page, but popup.show() does not do anything , any idea?
      function loadItem(event) {

      alert("clicking to show popup ");
      var popup = AdfPage.PAGE.findComponent("delPopup");
      popup.show();
      }
        • 1. Re: displaying pop up on click of commandMenuItem
          629225
          Hello All,

          The related example would be panelCollection view menu with commandMenuItem "Reorder Columns" opens a modal dialog window

          I want to do achieve same thing.

          Any help is aprreicated.

          Thank you
          • 2. Re: displaying pop up on click of commandMenuItem
            PaKo
            Hi!

            Without all page code it is not possible to give you a clear answer.

            Look at this thread where I have similar problem:
            Re: setActionListener with showPopupBehavior not working?


            Regards,

            PaKo
            • 3. Re: displaying pop up on click of commandMenuItem
              629225
              I wish I can post images to this forum ....

              anyways its pretty simple

              I have contextMenu on table

              <af:table id="table1" contextMenuId="myRightClickMenuPopup"/>

              <af:popup id="myRightClickMenuPopup"> //this contains af:menu

              <af:menu id="newMenu">
              <af:commandMenuItem id="item1" text="first item/>
              <af:commandMenuItem id="item2" text="second item/>
              <af:commandMenuItem id="item3" text="third item>

              <af:clientListener name="myJSmethod" type="click"/>

              </af:commandMenuItem>



              </af:memu>
              </af:popup>


              //popup that I want to display when I click on commandMenuItem

              <af:popup id="anotherPopup"><af:outputText id="outputText1" value="output text component inside popup"/>
              </af:popup>

              Javascript goes here

              function myJSmethod(event) {
              {
              var popup = AdfPage.PAGE.findComponent("anotherPopup");
              popup.show();
              }

              I hope I am able to clear up the scenario
              • 4. Re: displaying pop up on click of commandMenuItem
                PaKo
                Hi!

                First, your code is not correct: clientListener does not have property name but method for client script invokation.

                Second, as you have not provided complete page, I cannot tell you if something else is wrong.

                Anyhow, the folowing page works fine for me in FF3.0.3:
                <?xml version='1.0' encoding='UTF-8'?>
                <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:f="http://java.sun.com/jsf/core"
                          xmlns:h="http://java.sun.com/jsf/html" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                          xmlns:dvt="http://xmlns.oracle.com/dss/adf/faces">
                  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
                  <f:view>
                    <af:document>
                      <af:messages/>
                      <af:form>
                        <af:table value="#{bindings.SampleGraphDataRow.collectionModel}" var="row"
                                  rows="#{bindings.SampleGraphDataRow.rangeSize}"
                                  emptyText="#{bindings.SampleGraphDataRow.viewable ? 'No rows yet.' : 'Access Denied.'}"
                                  fetchSize="#{bindings.SampleGraphDataRow.rangeSize}"
                                  selectedRowKeys="#{bindings.SampleGraphDataRow.collectionModel.selectedRow}"
                                  selectionListener="#{bindings.SampleGraphDataRow.collectionModel.makeCurrent}" rowSelection="single"
                                  contextMenuId="myRightClickMenuPopup">
                          <af:column sortProperty="year" sortable="false" headerText="#{bindings.SampleGraphDataRow.hints.year.label}">
                            <af:outputText value="#{row.year}"/>
                          </af:column>
                          <af:column sortProperty="value" sortable="false"
                                     headerText="#{bindings.SampleGraphDataRow.hints.value.label}">
                            <af:outputText value="#{row.value}">
                            </af:outputText>
                          </af:column>
                        </af:table>
                        <af:popup id="myRightClickMenuPopup">
                          <af:menu id="newMenu">
                            <af:commandMenuItem id="item1" text="first item"/>
                            <af:commandMenuItem id="item2" text="second item"/>
                            <af:commandMenuItem id="item3" text="third item">
                              <af:clientListener type="click" method="test"/>
                            </af:commandMenuItem>
                          </af:menu>
                        </af:popup>
                      </af:form>
                      <f:facet name="metaContainer">
                        <f:verbatim>
                          <script>
                                function test(e) {
                                    alert(e);
                                }
                            </script>
                        </f:verbatim>
                      </f:facet>
                    </af:document>
                  </f:view>
                </jsp:root>
                Regards,

                PaKo
                • 5. Re: displaying pop up on click of commandMenuItem
                  629225
                  Hello Pako,

                  Thanks for your response, yes I had a typo

                  Regarding this
                  PaKo wrote:
                  <af:popup id="myRightClickMenuPopup">
                  <af:menu id="newMenu">
                  <af:commandMenuItem id="item1" text="first item"/>
                  <af:commandMenuItem id="item2" text="second item"/>
                  <af:commandMenuItem id="item3" text="third item">
                  <af:clientListener type="click" method="test"/>
                  </af:commandMenuItem>
                  </af:menu>
                  </af:popup>
                  </af:form>
                  <f:facet name="metaContainer">
                  <f:verbatim>
                  <script>
                  function test(e) {
                  alert(e);
                  }
                  </script>
                  </f:verbatim>
                  </f:facet>
                  </af:document>
                  </f:view>
                  </jsp:root>
                  I am able to generate Javascript alert when I open contextMenu and click on the commandMenuItem, but instead of that I want to show af:popup component

                  Is it possible ??

                  Regards
                  simplyadf
                  • 7. Re: displaying pop up on click of commandMenuItem
                    629225
                    it was a problem in the way I was displaying popup...

                    but it works fine

                    Thanks
                    • 8. Re: displaying pop up on click of commandMenuItem
                      PaKo
                      Good! Next time post more of your code so it is easier to help you.

                      Regards,

                      PaKo