PDA

View Full Version : PIcker selection functionality



joesinla
2 Jan 2013, 1:10 PM
I'm creating a custom picker that dynamically loads data to three slots. Each slot requires the selection of the preceding slot. This works great by actually tapping on the item in the slot, however the problem is when sliding or rolling the selection without actually tapping it will not select the item. Is there a way to have a picker slot load a selection wether or not you actually 'tap' the item?

mitchellsimoens
4 Jan 2013, 5:27 AM
So you want to programmatically select a value in a slot?

joesinla
4 Jan 2013, 9:45 AM
No. What I mean is when using the Picker you it will only select the selection if the selection is actually tapped on in the slot. If the user tries to just slide using vertical swipe, the selection, even though highlighted, is not selected. Most users just slide the slot and don't tap the slot selection. I hope that makes more sense. Thank you kindly for your help!

cyee
25 Jan 2013, 2:22 PM
You could try listening for the dragend event on the slot div.




var myPicker = Ext.ComponentQuery.query('mypicker');
var slot = myPicker.down('#slotID');
var el = slot.element;

var onDragend = function(...) {
...
};

el.addListener('dragend', onDragend);

joesinla
25 Jan 2013, 2:28 PM
Beautiful! That makes total sense. I'll try that...

simsimmal
14 Feb 2013, 12:36 AM
Hello, i'am trying to programmatically select a value in a slot? Seems i'am missing something in the docs. Please give me a hint.

joesinla
14 Feb 2013, 7:55 AM
Hello, i'am trying to programmatically select a value in a slot? Seems i'am missing something in the docs. Please give me a hint.

Good question, I'm not sure about that. I looked that up too and didn't see anyway to set the picker or picker slot selection. Please post back if you find an answer to that.

mitchellsimoens
14 Feb 2013, 8:11 AM
Hello, i'am trying to programmatically select a value in a slot? Seems i'am missing something in the docs. Please give me a hint.

Here is an example (code in red is the important snippet):


var picker = Ext.create('Ext.picker.Picker', {
slots : [
{
name : 'speed',
title : 'Speed',
data : [
{ text : '50', value : 50 },
{ text : '100', value : 100 },
{ text : '200', value : 200 },
{ text : '300', value : 300 }
]
},
{
name : 'unit',
title : 'Unit',
data : [
{ text : 'KB/s', value : 'kbps' },
{ text : 'MB/s', value : 'mbps' }
]
}
]
});

picker.setValue({
speed : 200,
unit : 'mbps'
});

Ext.Viewport.add(picker);
picker.show();

The setValue takes an object with the property being the name of the slot and the value being the value of the slot.

simsimmal
21 Feb 2013, 1:18 AM
so obvious,

thanks a lot!