PDA

View Full Version : How to get selected value from picker



joel.m.stein
13 Feb 2011, 7:49 PM
I'm pretty new to Sencha Touch but have been having fun figuring it out using the examples and API.

I have a basic question about pickers such as the one below. How do I get the user-selected value from a slot? I had no problem using getValue with DatePicker to return a date (maybe a date object), but in this case getValue returns an object rather than the value I anticipated. There must be a simple way to get the selected value string such as "50" or "100" below?



var picker = new Ext.Picker({
slots: [
{
name : 'limit_speed',
title: 'Speed',
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}
]
}
],
listeners: {
"hide": function(picker) {
selectedValue = picker.getValue();
}
}
});
picker.show();

gmenuet
14 Feb 2011, 3:06 AM
Did you try picker.getValue()['limit_speed'] ?

joel.m.stein
14 Feb 2011, 4:30 AM
Perfect. Thanks!

borden0108
7 Nov 2011, 2:05 AM
could i grab a look at your code i am looking to use the value from a picker and picker.getValue()['req_day']; did not work