on 04-20-2015 12:10 PM
Hi guys,
I want to call a certain function everytime a control gets created. I can think of 3 ways to do so:
None of these options are suitable as of yet.
Did someone do some research on that topic and could share his results?
Or maybe other ideas/functionality SAPUI5 has to offer.
Thanks
You can make use of onAfterRendering event handler of the control to call your own functions once the control is rendered in the UI,
oControl.addEventDelegate({
onAfterRendering : function(oEvent){
yourFunction();
}
});
-Sakthivel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you guys for your answers.
I think I described my problem poorly so let me rephrase: I want to call a certain function everytime any control gets initialized.
So if my page contains a button, a text field and a dropdown box I need to extend every single control using your posted code lines. But to scan my code to find out which specific controls I'm using is super annoying and hard to maintain so I hoped there would be an easier way. But I guess there is no event which gets kind of called whenever any constructor gets used, right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And of course you can also try to play with overwriting existing super class methods, e.g. initialization of each Element. Please find example here - JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...
extend is not time consuming
just
sap.m.StandardListItem.extend('MyListItem', {
init : function() {
this.setProperty("info", "!!!");
},
renderer: function(oRm, oControl) {
sap.m.StandardListItemRenderer.render.apply(this, arguments);
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.