I am trying to click a button and open an alert with some inputs. Check out the setup and the issues are int he comments
...
constructor(app){
// here I instantiate the Alert for lather use
this.dataAlert = this.initiateAlert();
}
onPageDidEnter() {
this.getSomeData();
}
// this is a function called by a button
// here I attempt to open the alert and here is where the issue occurs
// if I pass "this.dataAlert", the Alert opens fine, but only once. If i close and reopen it, well.. it breaks, nothing happen
// if I pass "this.initiateAlert()", the Alert opens fine every time, but it only has the initial RADIO INPUT (show all), the other inputs are not there
filterContent() {
this.nav.present(this.dataAlert);
}
// here I initiate the Alert. at this point it only has the OK and CANCEL buttons and one RADIO INPUT
initiateAlert() {
let alert = Alert.create();
alert.setTitle('Show only..');
alert.addInput({type: 'radio', label: 'Show all', value: true, checked: false});
alert.addButton('Cancel');
alert.addButton({
text : 'Ok',
handler: data => {
if (data !== undefined) this.showAll = data;
}
});
return alert;
}
// here I have some data that I use to build the other RADIO INPUT fields on the alert
getSomeData(){
let data = someData;
for (var name in data.content) {
this.dataAlert.addInput({type: 'radio', label: response.title, value: response.name, checked: false});
}
}
Any ideas?