PDA

View Full Version : Public Events on API Docs



AndreaCammarata
22 Jan 2011, 5:05 AM
Hi guys,
I notice that there is a "bug" on the official API docs for some events listed of every component.
I explain better what i mean, talking like I was a new Sencha User.
Let's take for example the Ext.Panel doc:

If I take a look to the "Public Events" section I can see that Panel components has a afterrender event.
After I know about this event I want to extend Ext.Panel class in this way:



Ext.ns('ux')

ux.loginPanel = Ext.extend(Ext.Panel, {

afterrender: function(cmp) {

ux.loginPanel.superclass.afterrender.call(this, cmp);

console.info('The panel finish to render');

}

});
This is what I expect do do isn't?
But if I insert this ux inside my application I will never see the afterrender event fired, and this is simply why, the name of this event is not afterrender but afterRender. In fact if I change the event name



Ext.ns('ux')

ux.loginPanel = Ext.extend(Ext.Panel, {

afterRender: function(cmp) {

ux.loginPanel.superclass.afterRender.call(this, cmp);

console.info('The panel finish to render');

}

});
Everything works fine!
This is not for real a BIG bug, but it can create confusion to all new users.

Cheers guys.

mitchellsimoens
22 Jan 2011, 9:25 AM
The event is "afterrender" but the function inside Ext.Component is afterRender. If you want to listen to the "afterrender" event you would do this:


new Ext.Panel({
...
listeners: {
afterrender: fucntion(cmp) {}
}
})

Functions are camelCase but events are all lowercase.

AndreaCammarata
23 Jan 2011, 2:52 AM
Thanks for giving an explaination on this topic, but me, you and some people already know about it and some people else doesn't know bacause maybe they are beginning to approaching to Sencha framework.
So a new user that reads the docs, how can know about it without look inside the source code of the components?
Is this written in some place inside the official docs?