This discussion is archived
8 Replies Latest reply: Nov 19, 2012 3:14 AM by adf_user RSS

Invoking multiple popup programmatically.?

adf_user Newbie
Currently Being Moderated
Hi All,
JDev ver: 11.1.2.3

I've a <af:table> with single row which is displaying some id in form of commandLink. I need to show a popup (non-modal dialog box) onclick of any link. For instance, if user clicks on multiple links, it should display multiple popup.

I tried the below from http://docs.oracle.com/cd/E16162_01/web.1112/e16181/af_dialog.htm#BEJIHFFH so far with no luck. I'm able to show only single popup because of hardcoded id ("p1")
Example 15-9 Backing Bean Method Invoking a Popup

public void showPopup(ActionEvent event) {
{
   FacesContext context = FacesContext.getCurrentInstance();
   UIComponent source = (UIComponent)event.getSource();
   String alignId = source.getClientId(context);
   RichPopup.PopupHints hints = new RichPopup.PopupHints();
      hints.add(RichPopup.PopupHints.HintTypes.HINT_ALIGN_ID,source)
      .add(RichPopup.PopupHints.HintTypes.HINT_LAUNCH_ID,source)
      .add(RichPopup.PopupHints.HintTypes.HINT_ALIGN,
      RichPopup.PopupHints.AlignTypes.ALIGN_AFTER_END);
   p1.show(hints);
}
Is there any way of dynamically generating the popup.?

Thanks!!!
  • 1. Re: Invoking multiple popup programmatically.?
    Cvele_new_account Expert
    Currently Being Moderated
    So, you have not a popup designed at design time ?
    Also, can you please past here the af:table source code ?
  • 2. Re: Invoking multiple popup programmatically.?
    adf_user Newbie
    Currently Being Moderated
    Yes,
    Right now I had to specify a popup component in my jsf page in order to bind the component to a backing bean.

    Below is the af:table implementation:
     <af:table value="#{myBean.users}" var="row" rowBandingInterval="0" id="t2" clientComponent="true"
                          contentDelivery="immediate" displayRow="last" columnStretching="last"
                          horizontalGridVisible="false" verticalGridVisible="false">
        <af:column sortable="false" align="start" id="c3" noWrap="false" width="60">
              <af:commandLink id="ot3" text="#{row}">
                    <af:showPopupBehavior popupId="::popupRegion1"/>
              </af:commandLink>
        </af:column>
     </af:table>
    This was what I was doing before using programatic way of calling the popup. Sorry I reverted the whole thing so I could not post it. Previously I've set the PartialSubmit & ActionListener properties to the af:commandLink.

    Edited by: adf_user on Sep 26, 2012 1:21 PM
  • 3. Re: Invoking multiple popup programmatically.?
    Cvele_new_account Expert
    Currently Being Moderated
    I'm not sure I understand, and I'm going to talk unverified story, but try to add af:popup as child of your af:commandLink inside table.
    And link showPopupBehaviour with that popup...huh ?
  • 4. Re: Invoking multiple popup programmatically.?
    adf_user Newbie
    Currently Being Moderated
    Actually what I meant is something like below
    <af:table value="#{myBean.users}" var="row" rowBandingInterval="0" id="t2" clientComponent="true"
                          contentDelivery="immediate" displayRow="last" columnStretching="last"
                          horizontalGridVisible="false" verticalGridVisible="false">
        <af:column sortable="false" align="start" id="c3" noWrap="false" width="60">
              <af:commandLink id="ot3" text="#{row}" PartialSubmit="true" ActionListener="#{myBean.showPopup}"/>
        </af:column>
     </af:table>
  • 5. Re: Invoking multiple popup programmatically.?
    825535 Newbie
    Currently Being Moderated
    I have a similar requirement- showing multiple popups for each row clicked in the table.
    @OP: Have you been able to fix this issue?

    Anyone else who have had similar requirements and got through fixing it?
  • 6. Re: Invoking multiple popup programmatically.?
    adf_user Newbie
    Currently Being Moderated
    Nope.. Still I've the issue.
  • 7. Re: Invoking multiple popup programmatically.?
    Kamaal,SaifKamaal Explorer
    Currently Being Moderated
    Use this code to your liking

    Jsff Code
    <af:commandImageLink id="commandImageLink1" icon="/ui/image/icons/list.png" partialSubmit="true"
                                                          actionListener="#{ManagementPageBean.openKpiListener}" partialTriggers="::ctbRefreshKPI"
                                                          immediate="true">
                                        <af:showPopupBehavior triggerType="click"/>
                                        <af:setActionListener from="#{row.Kpi}" to="#{requestScope.selectedKpi}"/>
                                        <af:clientListener method="enforcePreventUserInput" type="action"/>
                                        <f:attribute name="row.KpiDescription" value="#{row.KpiDesc}"/>
                                        <f:attribute name="row.Achieved" value="#{row.Achieved}"/>
                                     </af:commandImageLink>
    Bean Code
        public void openKpiListener(ActionEvent actionEvent) {
          RichPopup.PopupHints hints = new RichPopup.PopupHints();
          String kpiDescription = (String)actionEvent.getComponent().getAttributes().get("row.KpiDescription");
          //String achieved = (String) actionEvent.getComponent().getAttributes().get("row.Achieved");
          String achieved = (String) EL.get("#{pageFlowScope.achieved}");
          if(achieved == null) achieved = "kpiNotPressed";
          logger.info("kpiDescription : " + kpiDescription);
          if (kpiDescription.equalsIgnoreCase("Opportunities") && achieved.equals("kpiPressed")){
            pkpiActiveOppCount.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Activities") && achieved.equals("kpiPressed")) {
            pkpiActivityCount.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Closing Ratio") && achieved.equals("kpiPressed")) {
            pkpiClosingRatio.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Ageing") && achieved.equals("kpiPressed")) {
            pkpiOppAgeing.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Test") && achieved.equals("kpiPressed")) {
            pkpiNosTestDrive.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Test Drive Conversion Ratio") && achieved.equals("kpiPressed")) {
            pkpiTestDriveConversionRatio.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Visits") && achieved.equals("kpiPressed")) {
            pkpiNosOfVisits.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Some Ratio") && achieved.equals("kpiPressed")) {
            pkpiVisitRatio.show(hints);
          }
          if(kpiDescription.equalsIgnoreCase("Somethingy") && achieved.equals("kpiPressed")) {
            pkpiAvgUnitsPerOpp.show(hints);
          }
            //EL.invokeMethod("refreshKpiDetails");
        }
  • 8. Re: Invoking multiple popup programmatically.?
    adf_user Newbie
    Currently Being Moderated
    I believe all the popups - 'pkpiActiveOppCount', 'pkpiClosingRatio' etc are already defined. What I was looking for is dynamic.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points