Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 11, 2014 at 05:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 10, 2014 at 05:46 PM

    Hi Ushinar,

    I don't think this will work as these listener methods would only work with the MVC architecture of SAP UI5.

    Try to replace all these listeners by listener methods available for window and dom object like window.onload or $(document).ready.

    Regards,

    Rohit Negi.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ushinar,

      In that case, you can try using IE10 set as IE9 Quirks mode in the browser and can include meta tag in the irpt/html file of your MVC structure for IE10 standards document mode.

      This way, MII portal will be loaded in IE9 quirks mode and your UI5 page with MVC structure will be rendered properly using IE10 standards mode.

      You can even try if MVC works in IE9 standards mode and can include the meta tag accordingly, if you do not want to upgrade your browser, I havent tried this.

      Regards,

      Anuj