问题
MainWindow.js
Ti.App.addEventListener('checkFirstName', function(e) {
FirstNameTextField.text = 'First Name ' + e.FirstNameValue
});
Ti.App.addEventListener('checkLastName', function(e) {
LastNameTextField.text = 'Last Name ' + e.LastNameValue
});
Ti.App.addEventListener('checkGender', function(e) {
GenderTextField.text = 'Gender ' + e.GenderValue
});
Ti.App.addEventListener('checkDateOfBirth', function(e) {
DateOfBirthTextField.text = 'Date of Birth ' + e.DateOfBirthValue
});
ChildWindow.js
DoneButton.addEventListener('click', function() {
FirstNameWindow.close();
});
FirstNameWindow.addEventListener('close', function() {
Ti.App.fireEvent('checkFirstName', {
FirstNameValue:FirstNameField.value
});
I have four listener's in my main Window which updates the values of Text Fields in a TableViewRow. The TableViewRow is dynamic as each row gets populated on click of button.
When i click on my first button, the row gets populated and clicking on it navigates to child window from there i update the value back to my row. But for the second, third and fourth it does not. But when i add another row with a click of button... the value gets populated.
来源:https://stackoverflow.com/questions/5723534/ti-app-addeventlistener-behaving-strangely