PDA

View Full Version : I don't get createCallback method



sg707
15 Feb 2011, 9:32 AM
As of now I'm browsing the manual for ExtJS Core and I see this snipet of the code



var sayHello = function(firstName, lastName){
alert('Hello ' + firstName + ' ' + lastName);
};
Ext.get('myButton').on('click', sayHello.createCallback('John', 'Smith');


but I can easily to this as well



var sayHello = function(firstName, lastName){
alert('Hello ' + firstName + ' ' + lastName);
};
Ext.get('myButton').on('click', function() {sayHello('John', 'Smith');};


So am I really missing something or are they equivalent way of doing the same?