I pop a picker from a label onClick event. The picker view is set by a <Require> tag. I return the selected value from the picker onClose event, but where does it go? How do I get a handle on that value?
Parent View
<Alloy> <Window id="vendorCheckIn"> <ScrollView id="checkInForm" class="formLayout"> <TextArea id="checkInNote" /> <View id="timePicker" layout="horizontal" top="50dp"> <Label id="timePickerLabel" text=" Set Location Hours" /> </View> </ScrollView> </Window> </Alloy>Parent Controller
var helper = require('helpers'); helper.log(JSON.stringify(this)); $.timePickerLabel.addEventListener('click',function(e){ return Alloy.createController('timePicker').getView().open(); });Child View
<Alloy> <Window id="pickerWindow" class="container" backgroundColor="blue" exitOnClose="true"> <Picker id="picker" top="50" selectionIndicator="true" useSpinner="true"> <PickerColumn id="hours"> <PickerRow title="" /> <PickerRow title="1"/> <PickerRow title="2"/> <PickerRow title="3"/> <PickerRow title="4"/> </PickerColumn> </Picker> <Label id="pickerClose" text="Close" /> </Window> </Alloy>Child Controller
var pickerVal; $.picker.addEventListener('change',function(e){ return pickerVal = e.row.title; }); $.pickerClose.addEventListener('click',function(e){ alert('pickerVal = ' + pickerVal); $.pickerWindow.close(); return pickerVal; });