Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (androidview)
Viewing all articles
Browse latest Browse all 5

Android optionDialog androidView with multiple pickers

$
0
0

I have made this optionDialog for Android which shows two pickers for selecting an age range.

var agePicker = Ti.UI.createPicker({
    useSpinner: true
});
 
var from = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
var to = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
 
var column1 = Ti.UI.createPickerColumn();
for(var i=0, ilen=from.length; i<ilen; i++)
{
    var row = Ti.UI.createPickerRow({title: from[i]});
    column1.addRow(row);
}
 
var column2 = Ti.UI.createPickerColumn();
for(var i=0, ilen=to.length; i<ilen; i++)
{
    var row = Ti.UI.createPickerRow({title: to[i]});
    column2.addRow(row);
}
 
agePicker.add([column1,column2]);
 
var opts = {
    title: 'Age',
    buttonNames: ['Ok'],
    androidView:agePicker,
    opaquebackground:true
};
 
var dialog;
$.age.addEventListener('click',function()
{
    dialog = Ti.UI.createOptionDialog(opts);
    dialog.addEventListener('click', onSelectDialog);
    dialog.show();
});
 
function onSelectDialog(e)
{
    //e.source.value;
    //e.source.selectedIndex[1];
    //Ti.API.debug(JSON.stringify(e));
    console.log(e.source.children[0].value);
}
As the onSelectDialog() shows i'm having trouble finding out how to get the values selected in my two pickers. Debugging 'e' did'nt clear my mind - anyone knows have to get the selected values?

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images