Get selected row from Picker in Titanium Alloy



In Titanium Alloy I have made a Picker that consists of 'rows'. Users can select one of these rows and click a button to continue to the next window. What I want is that the button sends the user to the right window depending on the selected row in the picker. My code is as follows:


Alloy:



<Alloy>
<Window>
<Picker id="picker">
<Column id="rows">
<Row title="Row1" />
<Row title="Row2" />
<Row title="Row3" />
<Row title="Row4" />
</Column>
</Picker>
<Button id="button" title="Confirm" bottom="10%" width="115" height="50" />
</Window>
</Alloy>


JavaScript/jQuery:



$.picker.addEventListener('change',function(e) {
var selectedrow = e.rowIndex; // e.rowIndex determines row number
});

$.button.addEventListener('click',function(e) {
if(selectedrow = "3") {
$.tabs.open();
}
else {
$.tabs2.open();
}
});


The problem is that every selection sends the user to the same new window, like the else-statement is being ignored. How can I fix this?


No comments:

Post a Comment