sap.ui.define([
"sap/ui/model/json/JSONModel",
"sp/ui/Device"
], function (JSONModel, Device) {
"use strict";
return {
createDeviceModel: function () {
var oModel = new JSONModel(Device);
oModel.setDefaultBindingMode("OneWay");
return oModel;
},
createServiceModel: function () {
var oServices = [{
"url": "<Sharepoint URL>",
"name": "Go to Sharepoint"
}, {
"url": "<Support page URL>",
"name": "Go to Support page"
}, {
"url": "<Chatbot app URL>",
"name": "Open ChatBot Helper"
}];
var oModel = new JSONModel(oServices);
oModel.setDefaultBindingMode("OneWay");
return oModel;
}
};
});
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<ActionSheet title="Select a Service" placement="Bottom" buttons="{path: 'service>/'}">
<buttons>
<Button text="{servcie>name}" press="onServiceSelected"/>
</buttons>
</ActionSheet>
</core:FragmentDefinition>
init: function () {
UIComponent.prototype.init.apply(this, arguments);
this._createLaunchpadButton();
this.setModel(models.createServiceModel(), "service");
this.setModel(models.createDeviceModel(), "device");
},
getRenderer: function () {
var oDeferred = new jQuery.Deferred();
this._oShellContainer = jQuery.sap.getObject("sap.ushell.Container");
if (!this._oShellContainer) {
oDeferred.reject("Illegal state: shell container not available");
} else {
var oRenderer = this._oShellContainer.getRenderer();
if (oRenderer) {
oDeferred.resolve(oRenderer);
} else {
this._onRendererCreated = function (oEvent) {
oRenderer = oEvent.getParameter("renderer");
if (oRenderer) {
oDeferred.resolve(oRenderer);
} else {
oDeferred.reject("Illegal state: shell container not available");
}
};
this._oShellContainer.attachRendererCreatedEvent(this._onRendererCreated);
}
}
return oDeferred.promise();
},
_createLaunchpadButton: function () {
this._getRenderer().fail(function (sErrorMessage) {
jQuery.sap.log.error(sErroMessage, undefined, "shellExtended.shellExtend.Component");
}).done(function (oRenderer) {
oRenderer.addHeaderEndItem("sap.ushell.ui.shell.ShellHeadItem", {
id: "shellExtend.shellExtend",
icon: "sap-icon://sys-help",
tooltip: "Help Panel",
press: this._showHelpMenu.bind(this)
}, true, false);
}.bind(this));
},
_showHelpMenu: function (oEvent) {
var oButton = oEvent.getSource();
if (!this._cMenu) {
this._cMenu = sap.ui.xmlfragment("shellExtend.shellExtend.fragments.ActionSheet", this);
this._cMenu.setModel(this.getModel("service"), "service");
}
this._cMenu.openBy(oButton);
},
onServiceSelected: function (oEvent) {
var oBindingContext = oEvent.getSource().getBindingContext("service");
var sSelectedServiceUrl = oBindingContext.getProperty("url");
window.open(sSelectedServiceUrl, '_blank');
},
Tile type: | Static Tile |
Semantic Object | Shell |
Action | Plugin |
Application Type: | SAPUI Fiori App |
URL | URL of the App index file (/sap/bc/../ZSHELL_PLUGIN/webapp) |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |