PDA

View Full Version : How to get selected value from Picker



coverflex
25 Jun 2011, 10:56 AM
I have changed the "Picker" index.js File in Sencha Touch's Examples slightly and want to get the selected value when Button "Done" is tapped or clicked.

What am I doing wrong to get the value?
The innerHTML of textPicker changes to: "Selected Value: [Object object]"

... (added to touch_1.1.0/examples/picker/src/index.js):


var textPicker = new Ext.Panel( {
html: 'Init HTML'
} );

var listPicker = new Ext.Picker( {
height: 300,
cancelButton: 'Abbruch',
doneButton: 'Erledigt',
slots: [{
name: 'limit_speed',
align: 'right',
useTitles: true,
title: 'Uebertragungsgeschwindigkeit',
data: [
{ text: '50 KB/s', value: 50 },
{ text: '100 KB/s', value: 100 },
{ text: '200 KB/s', value: 200 },
{ text: '300 KB/s', value: 300 }
]
}
]
} );

listPicker.on( 'change', function ()
{
var v = listPicker.getValue();
textPicker.body.update( 'Selected Value: ' + v );
} );