• Application Layout control - basicLeafNode - onClick event

    By Ulrich Krause 1 decade ago

    We use the Application Layout Control ( oneUI ) in our application. In the bannerUtilityLinks we render some basicLeafNodes.

    One of the nodes has a call to a SSJS function in onClick event.

    The help says that this event is only triggered, when the node is clicked and the href is empty.


    1. if href is NOT empty, a click on the node opens the target = OK
    2. href is empty + SSJS in onClickEvent = NOT OK



      The expected behaviour would be that the SSJS is executed, when a user clicks the node. BUT: The function is called as soon as the page is rendered.



      I could reproduce this issue on different machines
    • This event is client side

      By Philippe Riand 1 decade ago

      The onClick event can only contains client JS. So if you put some SSJS, it is evaluated and the resulting string is passed as the client side event. As the nodes are not controls, you cannot have an event handler object for executing SSJS. Moreover, some of the nodes are dynamic, meaning that you don't know in advance the nodes.

      The solution is to set the submitValue property, and then assign an event to the container control onItemClick. There are several example of this is the demo DB.

      • Thx for explaining, but ...

        By Ulrich Krause 1 decade ago

        still a bit confusing. I tried to use the submittedValue.

        When I try to create the onItemClick event from the events tab, the generated code is not valid


            &lt;xe:eventHandler event=&quot;onItemClick&quot; submit=&quot;true&quot;<br/>
                refreshMode=&quot;complete&quot;&gt;<br/>
        

        <xe:this.action><![CDATA[#{javascript:true}]]></xe:this.action>

            &lt;/xe:eventHandler&gt;&lt;/xe:applicationLayout&gt;<br/>
        

        throws an unknown tag error and the page does not save.



        I can now ( according to the sample in the sample nsf ) change all xe to xp. This will let me change the page, but the event is not triggered.



        There is also an event in the properties of the applicationLayout control.



        This generates the following code


        &lt;xe:applicationLayout id=&quot;cois_application_layout&quot;<br/>
        

        onItemClick="#{javascript:true}">


            &lt;xp:callback facetName=&quot;facetNull&quot; id=&quot;facetNull&quot;/&gt;<br/>
            &lt;xe:this.facets&gt;<br/>
        



        But even here, my code is not triggered ( the "true" ist just a dummy to see, where the code is generated in the source )



        Not sure what's going on. Friday afternoon. Will give it another try later.

        • Ok,please send me your sample

          By Philippe Riand 1 decade ago

          I'll have a look at it