How to design different message Toasts in one sapui5 project?

726 views Asked by At

I want to display a different design message toasts in one project, How can I addStyleClass for each messageToast instance ? For example:

enter image description here enter image description here

I try to add an id or class for each different design but it didn't work:

success: function (oResp) {
                            sap.m.MessageToast.show(sSuccess, {
                                id: "tryingWell"
                            });
                        },

Any idea ??

1

There are 1 answers

0
Ruth On

I found a good way to design a MessageToast in sapui5: Example of template:

Controller:

   success: function (oResp) {
    sap.m.MessageToast.show(sSuccess);
                                                $(".sapMMessageToast").addClass("messageSuccess");
   },

Css:

.messageSuccess {
    background: black !important;
    opacity: 0.6;
}