View Full Version : How to catch spin event

30 Jun 2010, 12:00 AM
I have been able to integrate the SpinnerStrategy code I found from ext 1 & 2 into SpinnerField/spinner allowing me to have date fields with a spinner control. I have then embedded this control into a grid, I have declared the corresponding column as xtype: 'gridcolumn'. So if I use this spinnerfield for a number I no longer filter out any non numeric chars, though I can probably dig a bit and figure a way to do this.

I want to be able to catch the spin event and modify an adjacent column displaying the day of week for the date that i spin to. To do this I have added listeners: { spin: dateChange }, to the spinnerfield config data. This works but I was trying to add an on() function to the editor or possibly to the grid in order to get similar results as in
grid.on('afteredit', dateChange) here I get value and record directly from the event arg. As I said I have been able to work around this, but was wondering if someone could tell me how to bubble up the event, if there is no event listener at the spinnerfield level then the fireevent code doesn't propagate/bubble up. I tried to add "bubbleEvents: 'spin'" to config and this let the fired event go a tiny bit further (but it didn't allow me to see the event further up in at the grid level for example).

If there is interest I would be happy to post my code allowing the spinner to include date and time fields. It probably isn't too far from being backward compatable to the current 3.0 version, even though it doesn't have this code that was present in 2.0. Let me know where and how to post the code.


30 Jun 2010, 12:24 AM
Can't you just add a listener to the Spinner?

30 Jun 2010, 8:01 AM
That is what I did, and it works suprisingly since it looks like
editor: {
xtype: 'spinnerfield',
id: 'wrkdate',
listeners: { spin: dateChange },
//bubbleEvents: 'spin',
xtype: 'date',
format: 'm/d/y'
where dateChange is a function defined in a seperate module that instantiates the main panel. I guess it looks it up by name.
The code is presently working, I am more interested in learning how it should be done and learning how to get an event to bubble up beyond the scope of spinnerfield. I was not successful in externally locating wrkdate (Ext.getCmp('wrkdate') returned an object but the fired spin event wasn't seen by wkdateobject.on().