1
votes

I've just started using the xe:applicationLayout for an application. I have added a "Basic Node" to the "Place Bar". I want to run some server side JavaScript code onClick of the node/button. I have tried computing the onClick property of the Basic Node, but this doesn't do anything and it seems like the onClick only runs client side JavaScript.

Is there a property or node that can run SSJS? Thanks for any help.

2

2 Answers

1
votes

Not the nicest version but it works. Add buttons to the XPage and hide then using css. In your application layout add a client side script that gets a handle to the buttons using dojo.byId and do a click() on them. Then it's easy to have different panels update when you click on different buttons.

2
votes

Set the submittedValue property of the node. ( the procedure is the same for all places in the application layout; here is an example snippet for the banner.ApplicationLinks )

    <xe:this.bannerApplicationLinks>
                <xe:basicContainerNode styleClass="firstApplication" label="${langString_CRM['CREATE']}">
                    <xe:this.children>
                        <xe:basicLeafNode submitValue="company_new"

Then add an event handler to your page and run your SSJS depending on the submitted value

        <xp:eventHandler event="onItemClick" submit="true"
        refreshMode="partial" disableValidators="true" refreshId="cois_application_layout"
        execMode="partial">
        <xp:this.action><![CDATA[#{javascript:          
        var submittedValue=context.getSubmittedValue();
// evaluate the submitted value here ...