View Full Version : xtype selectfield listener question

24 Nov 2010, 1:37 PM

I was wondering if anyone can help me assign correct listeners to an xtype selectfield.

Here is what i have:

xtype: 'selectfield',
name : 'pizzaSize',
label: 'Pizza Size',
minHeight: 50,
listeners: {
onchange: {
fn: function(){ console.log('smting'); }

options: [
name: 'smting0',
text: '10"',
value: 0
name: 'smting',
text: ' 12" Extra 2.00$',
value: 2.00
{All I want here to happen is for the listener to trigger when a selection is made. i.e. when a user taps on one of the selectfield items. But right now the listener seems to never trigger...

Any help is appreciated.

24 Nov 2010, 1:52 PM
I found that I needed to add one line near the listener

click: {
element: 'el',
fn: function(){ console.log('smting'); }

Now my question would be more like if there is an onchange listener trigger that I could use instead of the click one I am using now...


25 Nov 2010, 1:32 AM
You could try the Change event.

change (http://dev.sencha.com/deploy/touch/docs/source/Select.html#event-Ext.form.Select-change) : ( Ext.form.Select this, Mixed value ) Fires when an option selection has changed
Fires when an option selection has changedListeners will be called with the following arguments:

this : Ext.form.Select
value : Mixed