Reputation: 791
I want to add rows into my picker depending on the user selection before, so I add the rows at runtime. On iOS the picker is refreshed and all works well but in Android nothing happens. I tried a lot of options but I can't do it.
This is my code:
index.xml
...
<TableViewRow id="row_seccion" layout="vertical">
<Label id="label_seccion" class="textField_label">CATEGORÍA</Label>
<Widget src="es.epi.comboBox2" class="selectField" id="seccion" onChange='comboBoxClick'platform='android'></Widget>
</TableViewRow>
<TableViewRow id="row_subseccion" layout="vertical">
<Label id="label_subseccion" class="textField_label">SUBCATEGORÍA</Label>
<View id="subseccion" platform='android'></View>
</TableViewRow>
...
index.js
function comboBoxClick(e){
Ti.API.debug("comboBoxClick " + e.value);
if(e.value != -1) rellenarSubsecciones(e.value);
}
function rellenarSubsecciones(value){
picker = Ti.UI.createPicker({
useSpinner: 'false',
height: 50,
left: 10,
right: 10
});
Ti.API.debug("Subsecciones: " + subsecciones.length);
for(var i = 0; i < subsecciones.length; i++)
{
var row = Ti.UI.createPickerRow(subsecciones[i]);
row.font = {fontFamily: Alloy.Estilos.fuentes.normal, fontSize: "18dp"};
row.color = "#222222";
row.backgroundColor = "#FFFFFF";
picker.add(row);
}
$.row_subseccion.add(picker);
}
I only need to refresh one view, but in Android seems impossible.
Upvotes: 1
Views: 408
Reputation: 3866
As the documentation on Ti.UI.Picker.add() says Once you use this method to add rows and columns to a picker, you cannot remove or manipulate them.
I'm not sure if this could be done, but you might want to do a Feature Request Appcelerator JIRA. Check if it has already been requested before you create a new ticket. Refer to this question and also link back to the ticket here so that others can watch it with you.
Upvotes: 0