问题
I have got an application layout with an image as banner. Is it possible to bind an event handler with an onclick event to the image in the banner?
<xe:applicationLayout id="applicationLayout1"><xp:this.facets></xp:this.facets>
<xp:callback facetName="facetMiddle" id="facetMiddle"></xp:callback>
<xe:this.configuration>
<xe:oneuiApplication productLogo="/ise_logo.png"
productLogoHeight="70px" productLogoWidth="250px">
<xe:this.bannerUtilityLinks>
</xe:this.bannerUtilityLinks>
<xe:this.titleBarTabs>
</xe:this.titleBarTabs>
<xe:this.footerLinks>
</xe:this.footerLinks>
</xe:oneuiApplication>
</xe:this.configuration>
</xe:applicationLayout>
回答1:
Add a class to your logo as Application Layout Banner's parameter with productLogoClass="applicationLogo"
.

Add then a client side onclick event for this class on client load with
var applicationLogo= dojo.query('.applicationLogo')[0];
applicationLogo.onclick = function() {
alert('clicked on logo');
}
In client side event code you can execute a partial refresh with XSP.partialRefreshGet or XSP.partialRefreshPost like shown here.
来源:https://stackoverflow.com/questions/26606544/onclick-event-banner-in-application-layout