how to Remove all rows from Picker?
how to Remove all rows from Picker ??
BTW it's plain data
3 Answers
-
this is my solution for pickers with one column:
picker.clear = function(){ if(picker.columns[0]) { var col = picker.columns[0]; var len = col.rowCount; for(var x = len-1; x >= 0; x-- ){ var row = col.rows[x]; col.removeRow(row); } } }
-
thePicker.columns = null;
-
Daniel was close but .columns=null is crashing for me.
partPicker.columns = []; partPickerData = [];
is working. Picker is created and loaded from a database by:
partPicker = Ti.UI.createPicker({ left: 0, width: 320, bottom: 215 }); while (rows.isValidRow()) { partPickerData.push({ title: rows.field(0), fontSize: 16 }); rows.next(); } partPicker.add(partPickerData);