SebaBasko
11/30/2017 - 3:25 PM

Common function for all UI5 controls

Example of common function for all UI5 controls

<!DOCTYPE html>
<html>
<head>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <script>
    var oDummy = new sap.ui.core.Control();
    sap.ui.core.Control.prototype.test = function(){
      alert('My Custom Function!');
    }
  </script>
  
  <script>
    var oButton = new sap.m.Button("btn",{text:"sample",press:function(oEvent){
      oButton.test();
    }});

    oButton.placeAt('content');
  </script>
</head>
<body>
<div id='content'>
</body>
</html>