on 10-27-2015 7:00 AM
Hi,
what is the use of event delegates in sapui5.? I have seen some examples where they use
this.addEventDelegate({
onAfterRendering : function(e)
{
// some logic
}});
My question is already in the controller we have onAfterRendering hook method which we can make use of, why to explicitly use delegates? I am a newbie please kindly help.
Thanks
Sushmitha
HI Sushmita
addEventDelegate is for the sapui5 view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well, answering your question - delegates support cloning which makes them pretty flexible for list binding - you define a delegate for a template and all the "cloned" objects (the way list binding works) will have the same delegate object
technically this tells you everything
Element.prototype._handleEvent = function (oEvent) {
var sHandlerName = "on" + oEvent.type;
this._callEventHandles(this.aBeforeDelegates.slice(0), sHandlerName, oEvent, true);
this._callEventHandles([this], sHandlerName, oEvent);
this._callEventHandles(this.aDelegates.slice(0), sHandlerName, oEvent, true);
};
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sdk doc is pretty clear
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.