Метка: fiori

Add custom button on header shell sap ui5

Hi guys I tell you how add custom button on header shell!

So I hope it will be help for you!


setfavbutton: function() {
/**
* ADD Chat Support Button
*/
function onSupportHeaderItemPress() {
var button = new sap.ushell.ui.footerbar.AddBookmarkButton();

var info = »;
var title = »;
var subtitle = »;
var icon = »;

if (icon === «») {
//set default icon
icon = «sap-icon://home»;
}
var button = new sap.ushell.ui.footerbar.AddBookmarkButton();
button.setAppData({
title: title, // default: «»
subtitle: subtitle, // default: «»
info: info, // default: «»
icon: icon // default: undefined
});
button.firePress();
};
// add button to the right side of the shellbar
try {

if (typeof(window.favbutton) === «undefined») {
var oRendererExtensions = jQuery.sap.getObject(‘sap.ushell.renderers.fiori2.RendererExtensions’);
window.favbutton = new sap.ushell.ui.shell.ShellHeadItem(‘supportChatBtn’, {
icon: sap.ui.core.IconPool.getIconURI(‘add-favorite’),
tooltip: ‘add to main’,
showSeparator: true,
press: onSupportHeaderItemPress
});
oRendererExtensions.addHeaderEndItem(window.favbutton);
}
} catch (err) {
sap.m.MessageToast.show(err.message);
}

},