• EventHandler - onItemClick ignored

    By Erich Schmidt 1 decade ago

     

    First, let me say that I have corrected for the xp->xe problem with an eventhandler in my custom control. Domino is 8.5.3, designer is 8.5.3.
    
     
    
    I have a custom control, LeftNavigator-Create, that uses xe:navigator. Its purpose is to create a configurable create action. Two properties, "Label" drives the label, 
    
     
    
    the other ("SubmitValue") is used in the eventHandler to direct the browser to the correct XPage, using context.getSubmittedValue.
    
     
    
    There is another custom control, AppLayout, which uses xe:applicationLayout. It includes xp:callback with facetName="LeftColumn" in a panel with 
    
     
    
    xp:key="LeftColumn". This custom control is added to various XPages. The XPages then can include the LeftNavigator-Create custom control (if appropriate) in the 
    
     
    
    "LeftColumn" callback.
    
     
    
    This worked in Domino 8.5.2 (server) using ExtLib 8.5.2 but now fails to work in Domino 8.5.3 and ExtLib 853.20111013-1854 -- clicking the create action does nothing 
    
     
    
    (for obvious reasons, see below).
    
     
    
    ExtLib is installed properly as everything else works, and there are no errors upon loading http and tell http osgi ss com.ibm.xsp.extlib shows everything 
    
     
    
    active/resolved/<<lazy>>.
    
     
    
    OBVIOUS REASONS: The html rendered in 8.5.3 is different than that from 8.5.2, as there is no href or onClick in 8.5.3. See below:
    
    8.5.2
    
    a href="javascript:;" onclick="javascript:XSP.setSubmitValue('Batch');XSP.fireEvent(arguments[0], "view:_id1:Main:_id28:_id29", 
    
     
    
    "view:_id1:Main:_id28:CreateNavigator", null, true, 2, null);" style="text-decoration:none; position: static; padding-left: 0px"
    
    8.5.3
    
    a style="text-decoration:none; position: static; padding-left: 0px"
    
     
    
    Perhaps I am doing this in an incorrect manner? I can investigate changes to the UI, but I would rather first understand what is going on here.
    
     
    
    Erich
    

    LeftNavigator-Create

     

    <xp:view
    
    xmlns:xp="http://www.ibm.com/xsp/core"
    
    xmlns:xe="http://www.ibm.com/xsp/coreex">
    
    <xe:navigator id="CreateNavigator">
    
    <xe:this.treeNodes>
    
    <xe:basicContainerNode
    
    submitValue="${javascript:compositeData.SubmitValue;}">
    
    <xe:this.label><![CDATA[${javascript:"Create " + compositeData.Label;}]]></xe:this.label>
    
    <xe:this.enabled><![CDATA[${javascript:sessionScope.VendorCode!=""}]]></xe:this.enabled>
    
    </xe:basicContainerNode>
    
    </xe:this.treeNodes>
    
    <xp:eventHandler
    
    event="onItemClick"
    
    submit="true"
    
    refreshMode="complete">
    
    <xp:this.action><![CDATA[#{javascript:var s = context.getSubmittedValue()
    
    if(s=="Batch") {
    
    sessionScope.put("BatchID", 0);
    
    context.redirectToPage("VendorDetailBatch");
    
    } else if(s=="RawReceipt") {
    
    sessionScope.put("RawReceiptID", 0);
    
    context.redirectToPage("VendorDetailRawReceipt");
    
    } else if (s=="Credential") {
    
    context.redirectToPage("ManageCredentialsDetail");
    
    } else {
    
    context.redirectToPage("ErrorPage");
    
    }}]]></xp:this.action>
    
    </xp:eventHandler>
    
    </xe:navigator>
    
    </xp:view>
    

     

    AppLayout

     

    <xp:view
    
    xmlns:xp="http://www.ibm.com/xsp/core"
    
    xmlns:xe="http://www.ibm.com/xsp/coreex"
    
    xmlns:xc="http://www.ibm.com/xsp/custom">
    
    <xp:this.resources>
    
    <xp:script
    
    src="/libJSBasic.jss"
    
    clientSide="false">
    
    </xp:script>
    
    </xp:this.resources>
    
    <xe:applicationLayout
    
    id="applicationLayoutView"
    
    onItemClick="${javascript:doLogout();}">
    
    <xe:this.facets>
    
    <xp:panel xp:key="LeftColumn">
    
    <xc:LeftNavigator/>
    
    <xp:callback
    
    facetName="LeftColumn"
    
    id="callback1"/>
    
    </xp:panel>
    
    <xp:callback
    
    xp:key="RightColumn"
    
    facetName="RightColumn"
    
    id="callback3">
    
    </xp:callback>
    
    </xe:this.facets>
    
    <xe:this.configuration>
    
    <xe:applicationConfiguration
    
    defaultNavigationPath="#{javascript:compositeData.defaultNavigationPath}"
    
    legalText="(c) 2011 My Company"
    
    navigationPath="#{javascript:compositeData.navigationPath}"
    
    placeBarName="#{javascript:compositeData.titleBarCaption}"
    
    productLogo=logo.gif"
    
    productLogoHeight="40px"
    
    titleBar="false">
    
    <xe:this.bannerApplicationLinks>
    
    <xe:basicLeafNode
    
    href="http://www.applegate.com/"
    
    label="Applegate Website">
    
    </xe:basicLeafNode>
    
    </xe:this.bannerApplicationLinks>
    
    <xe:this.bannerUtilityLinks>
    
    <xe:userTreeNode
    
    label="${javascript:sessionScope.CommonUserName}">
    
    </xe:userTreeNode>
    
    <xe:userTreeNode
    
    label="${javascript:sessionScope.VendorName;}">
    
    <xe:this.rendered><![CDATA[${javascript:return sessionScope.VendorName!="";}]]></xe:this.rendered>
    
    </xe:userTreeNode>
    
    <xe:basicLeafNode
    
    label="Logout"
    
    submitValue="logout">
    
    </xe:basicLeafNode>
    
    </xe:this.bannerUtilityLinks>
    
    <xe:this.footerLinks>
    
    <xe:basicContainerNode label="Help">
    
    <xe:this.children>
    
    <xe:basicLeafNode
    
    label="FAQ"
    
    image="vwicn011.gif"
    
    href="FAQ.xsp">
    
    </xe:basicLeafNode>
    
    <xe:basicLeafNode
    
    label="User Guide"
    
    image="vwicn001.gif">
    
    <xe:this.href><![CDATA[${javascript:var sName = @DbLookup("", "vwAttachments", "User Guide", 2);
    
     
    
    return getAppPath() + "/vwAttachments/User%20Guide/$FILE/" + sName;
    
    }]]></xe:this.href>
    
    <xe:this.rendered><![CDATA[${javascript:return (sessionScope.systemType == "Full")}]]></xe:this.rendered>
    
    </xe:basicLeafNode>
    
    <xe:basicLeafNode
    
    label="User Guide"
    
    image="vwicn001.gif">
    
    <xe:this.href><![CDATA[${javascript:var sName = @DbLookup("", "vwAttachments", "User Guide Suppliers", 2);
    
     
    
    return getAppPath() + "/vwAttachments/User%20Guide%20Suppliers/$FILE/" + sName;
    
    }]]></xe:this.href>
    
    <xe:this.rendered><![CDATA[${javascript:return (sessionScope.systemType != "Full")}]]></xe:this.rendered>
    
    </xe:basicLeafNode>
    
    <xe:basicLeafNode
    
    label="Contact Us"
    
    image="vwicn121.gif"
    
    href="HelpRequest.xsp">
    
    </xe:basicLeafNode>
    
    </xe:this.children>
    
    </xe:basicContainerNode>
    
    </xe:this.footerLinks>
    
    </xe:applicationConfiguration>
    
    </xe:this.configuration>
    
    <xp:callback id="OneUIMainAreaCallback"/>
    
    <xp:eventHandler
    
    event="onItemClick"
    
    submit="true"
    
    refreshMode="complete">
    
    <xp:this.action><![CDATA[#{javascript:var s = context.getSubmittedValue()
    
    if(s=="logout") {
    
    var url = facesContext.getExternalContext().getRequestContextPath();
    
    facesContext.getExternalContext().redirect(url + "?logout");
    
    }}]]></xp:this.action>
    
    <xp:this.script><![CDATA[if (confirm("Blah blah")) {
    
    return true;
    
    } else {
    
    return false;
    
    }]]></xp:this.script>
    
    </xp:eventHandler>
    
    </xe:applicationLayout>
    
    </xp:view>
    
    • Looking into this,could you send on your sample?

      By Paul Hannan 1 decade ago

      paul_hannan@ie.ibm.com

      PHAN8N2DMB

      Though this seems to work ok onthe Demo App...

       

                 
                          Current Choice #1 (full refresh):
                          
                          

                          
                          
                              
                                                                   submitValue="v1">
                                  

                                                                   submitValue="v2">
                                  

                                                                   submitValue="v3">
                                  

                              

                                                           refreshMode="complete">
                                   }]]>
                                       console.log("Submitted Value'"+XSP.getSubmitValue());
      }
      ]]>

                              

                          

                      

       

       

       

      • Likely something in my code...

        By Erich Schmidt 1 decade ago

        ...don't know what yet. I created a stripped down app with the same structure and it seems to work as expected. If I find anything interesting out I'll post it here

        Thanks!

      • No clue at this point

        By Erich Schmidt 1 decade ago

        Any insight or even guesses would be appreciated at this point.

        I'm running Domino and Notes 8.5.3, so that might be a problem, I suppose. But I've recreated the functionality in a new database and it works, still in my original database it does not. I have checked everything I can think of -- Application Properties, including but not limited to the theme being used, as I'm normally using an extension of oneuiv2; source of the various custom controls and XPages.

        The actual application does not lend itself to attachment, as it is fairly complex and requires a back-end database to read data from, and is proprietary anyway. As I said above, I did create something with the same basic structure (described below) but in that simple application it works! I'll attach below, but remember that it works properly there. The structure of the navigation of my application (and the attached application) is as follows:

        A "LeftNavigator" custom control, with xe:navigator; basically just a list of links to XPages that display data.

        A "LeftNavigator-Create" custom control, again with xe:navigator. One xe:basicContainerNode that takes two compositeData properties; one string for Label and one string identifier used to identify what action to take onItemClick. The onItemClick JS is in the xp:action of an xp:eventHandler and uses context.getSubmittedValue() to determine a sessionScope variable to set and the appropriate context.redirectToPage.

        An "AppLayout" Application Layout custom control; in "this.Facets", an xp:panel key="LeftColumn" containing xc:LeftNavigator as well as a callback with facetName "LeftColumn". There is also a "OneUIMainAreaCallback" and an xp:eventHandler for onItemClick that has this.action that performs a logout.

        AppLayout is then included on any "view" type XPage (typically one of those in xc:LeftNavigator), with appropriate properties for the xc:LeftNavigator-Create.

        All of this worked in 8.5.2 and Extlib 8.5.2.201104231636.


        Thanks! ExtLib is cool, my current difficulty notwithstanding!

        • Ignore this thread

          By Erich Schmidt 1 decade ago

          I am an idiot. Something did change in how the enabled property of the action was interpreted, but probably in a good way (null vs "", I would guess).