Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

get the selected value in a picker

$
0
0

I am trying to get the user's selected value from the picker, but actually my picker has some parameters to make the text centered in a label in it, so how do I get the select value

my picker code is here

var transformPicker = Titanium.UI.create2DMatrix().scale(0.7);
var picker = Ti.UI.createPicker({
    backgroundColor : '#ff9900',
    top : 70,
    heigth : 10,
    width : 350,
    transform : transformPicker
});
 
function addRow(text) {
    var row = Ti.UI.createPickerRow({
        id : text
    });
    var label = Ti.UI.createLabel({
        text : text,
        font : {
            fontSize : 22,
            fontWeight : 'bold'
        },
        color : 'black',
        width : '100%',
        textAlign : 'center',
        height : 40,
        backgroundColor : 'gray'
    });
    row.add(label);
    picker.add(row);
}
 
addRow('1435');
addRow('1434');
addRow('1433');
addRow('1432');
addRow('1431');
addRow('1430');
addRow('1429');
addRow('1428');
 
// turn on the selection indicator (off by default)
picker.selectionIndicator = true;
 
picker.setSelectedRow(0, 2, true);

and I need to get the selected value in the "year" variable here

button1.addEventListener('click', function(e) {
 
    if (tf_name.value == '') {
        alert("???? ????? ??? ????? ?????      ");
    } else {
        lic_death_result.url = '/main_windows/lic_death_result.js';
        lic_death_result.usreActionNo = tf_name.value;
        lic_death_result.year = year;
        Ti.UI.currentTab.open(lic_death_result, {
            animated : true
        });
    }
 
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles