Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to define SAP UI5 Event Handlers while not using MVC Pattern?

We were having an issue in IE9(Quirks Mode) SAP MII Portal where SAP UI5 pages were not getting loaded and it is because of the MVC Pattern what we were using to define separate view and controller page. So, we are now using view and controller as a simple javascript file and defining the UI5 controls to overcome the IE9 portal issue. But SAP UI5 has its own event handlers like "onAfterRendering"/"onInit"/"onBeforeRendering", so using  simple JS file (not using MVC), these functions can not be called by itself. Other simple functions like Button Press/Link Press, they all are working fine defined in the controller page.

This is what we are doing right now, but its not working.

function onAfterRendering() {

alert("OnAfterRendering");

}


So if anyone has any idea about it, please share, it will be highly appreciated.

Thanks always,

Ushinar

Former Member
Former Member replied

Hi Ushinar,

Even when you define SAP UI5 controls within normal javascript files you should be able to listen to SAP UI5 events. You can try the following:

Say, you have defined a SAP UI5 MatrixLayout as shown below:

var oLayout = new sap.ui.commons.layout.MatrixLayout();

And you want to do something in the onAfterRendering event of this layout, then you can do this:

oLayout.addEventDelegate({

  onAfterRendering : function () {

     alert("onAfterRendering...!!");

     }

});

Hope this helps!

Regards,

Ria

5 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question