FireGlow
8 Apr 2012, 8:19 AM
Hey there,
I'm trying hard to get the selected value of a picker. After a few hours I'm totally confused why it doesn't just work. I just used the code of the example and added listeners. Last standing is here::
var picker = Ext.create('Ext.Picker', {
id : 'picker',
hideOnMaskTap: true,
slots: [
{
name : 'player',
title: 'Player',
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: {
change : {
fn : function() {
for (myKey in Ext.getCmp('picker').getValue()){
alert (" Ext.getCmp('picker').getValue()["+myKey +"] = "+Ext.getCmp('picker').getValue()[myKey]);
}
}
},
pick : {
fn : function(picker, value) {
for (myKey in value)
{
alert ("value["+myKey +"] = "+value[myKey]);
}
}
}
}
});
Ext.Viewport.add(picker);
picker.show();
Both times the alert works but it only shows me value[player] = null or Ext.getCmp('picker').getValue()[player] = null. Is there anybody who can help me to get the selected value, since it is the most necessary functionality of a picker ;)
I'm trying hard to get the selected value of a picker. After a few hours I'm totally confused why it doesn't just work. I just used the code of the example and added listeners. Last standing is here::
var picker = Ext.create('Ext.Picker', {
id : 'picker',
hideOnMaskTap: true,
slots: [
{
name : 'player',
title: 'Player',
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: {
change : {
fn : function() {
for (myKey in Ext.getCmp('picker').getValue()){
alert (" Ext.getCmp('picker').getValue()["+myKey +"] = "+Ext.getCmp('picker').getValue()[myKey]);
}
}
},
pick : {
fn : function(picker, value) {
for (myKey in value)
{
alert ("value["+myKey +"] = "+value[myKey]);
}
}
}
}
});
Ext.Viewport.add(picker);
picker.show();
Both times the alert works but it only shows me value[player] = null or Ext.getCmp('picker').getValue()[player] = null. Is there anybody who can help me to get the selected value, since it is the most necessary functionality of a picker ;)