Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
ericci
Active Contributor
0 Kudos
1,154

Everyone know that sap.m.MessageToast is ugly (it’s mean to say but it’s damn true!) so when I want to deploy an app and I need to use some kind of toasts I always try to find the perfect library (that also support FontAwesome).


I’m talking about Toastr, a Javascript library for non-blocking notifications that require jQuery. Toastr is really powerful and easy to use and customize.



Links



Usage


Integration it’s pretty easy, you just need to follow a few steps. You have to bear in mind that this code is for SAP/OpenUI5 1.4x.x and it’s not tested (but it will work) for previous version.



Configure manifest.json


Add the library to sap.ui5 dependencies list and configure the resourceRoots to point where you uploaded the custom library.



"sap.ui5": {
...
"dependencies": {
"minUI5Version": "1.30.0",
"libs": {
...
"it.designfuture.toastr": {}
}
},
"resourceRoots": {
"it.designfuture.toastr": "./thirdparty/it/designfuture/toastr/"
}
}

How to use it inside your code


In your Component/Controller/Control add it.designfuture.toastr.Toastr as a dependency and just call it 😉



Toastr.info('This is a call title', 'And this is a call message', {
"closeButton": false,
"debug": false,
"progressBar": false,
"preventDuplicates": false,
"tapToDismiss": true,
"newestOnTop": true,
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
"showDuration": 300,
"hideDuration": 1000,
"timeOut": 5000,
"extendedTimeOut": 1000,
"rtl": false,
"onShown": null,
"onHidden": null,
"onclick": null,
"onCloseClick": null
});

Configurations and Methods


Toastr Config



Methods



Build


If you would like to extend and customize the control, you can easily do that but re-building the code with just a simple Grunt command:



npm install
grunt build
3 Comments
Labels in this area