PDA

View Full Version : Event Handling Basics...



dancha
4 Sep 2011, 6:13 AM
I understand event handling in javascript....I think. This is probably a super newbie question in extjs but.
in the doc I see a ton of 'events' for each component. Anyone have a really basic way to explain how I use those events or confirm if what I'm doing below is it? Feels like I'm missing something. Right now I'm implementing events by doing this:

Ext.getCmp('mySlider').on('change', function(slider, newValue, thumb, options )
{
//do stuff
}

because i see a documented event called change(slider, newValue, thumb, options ).

That's really it? Anyway to do that when I'm intitializing that slider? I see the listeners initializer but seems a little weird. Could use like a superbasic intro to this stuff so I know I'm doing it the preferred way.

mankz
4 Sep 2011, 9:19 AM
You pretty much summed it up. Either set listeners programmatically after creation, or use the 'listeners' config option at create-time :). Simple as that!

mankz
4 Sep 2011, 9:20 AM
Btw, here's a pretty nice intro: http://www.sencha.com/learn/legacy/Manual:Intro:Event_Handling

dancha
4 Sep 2011, 7:24 PM
Thanks. I guess it was easier than I thought.