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.
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.
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/"
}
}
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
});
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |