Hi,
I am trying to understand how ExtJS Event "plumbing" works, and I had a very simple question:
When defining events, are there any side effects if I change the property values of the object being passed to something different than "true" ? or is "true" just being used as a placeholder?
Employee = function(name){
this.name = name;
this.addEvents({
"fired" : true,
"quit" : true
});
}
Ext.extend(Employee, Ext.util.Observable);
I changed the value to "false", "undefined" or an empty string and I didn't notice any difference...
Employee = function(name){
this.name = name;
this.addEvents({
"fired":'',
"quit":''
});
}
Ext.extend(Employee, Ext.util.Observable);
var bob= new Employee("bob");
bob.addListener("fired", function(){
alert("Think of the children!");
}
);
bob.fireEvent("fired");
I looked at the API documentation for addEvents, but it is not much more descriptive 8- Meaning of Ext.Util.AddEvents parameters? - Ext JS Forums:: Meaning of Ext.Util.AddEvents parameters? Ext: Help Meaning of Ext.Util.AddEvents parameters? User Name. Remember Me? Password. FAQ. Members List http://extjs.com/forum/showthread.php?p=115206HOME | Ext: Help [Archive] - Page 27 - Ext JS Forums:: [Archive] Page 27 Community help forum for Ext JS version 2.0 Get to GridPanel on load event of store. Meaning of Ext.Util.AddEvents parameters? http://extjs.com/forum/archive/index.php/f-9-p-27.htmlHOME |
Parameters:
* object : Object
The object with the events defined
Returns:
* void
Thanks!
addEvents adds entries to the objects events array. This can be useful if you want to check if an event is supported, e.g.
if(obj.events['click']) {
// click event supported by obj
}
addListener will also add the event if it wasn't already in the events array.
ps. There are 3 ways to specify events:
obj.addEvents('event1', 'event2');
obj.addEvents({'event1':true, 'event2':true});
obj.addEvents({'event1':new Ext.util.Event(obj, 'event1'), 'event2':new Ext.util.Event(obj, 'event2')});
but due to a bug in Ext the first one doesn't work.
I Am a Sinner – What About You?
Global Sourcing and Supplier Online by Dylan
|