Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

how to Remove all rows from Picker?

how to Remove all rows from Picker ??
BTW it's plain data

— asked September 1st 2010 by Mohamed Fouad
  • picker
  • remove
0 Comments

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);
                }
        }
    }
    
    — answered June 24th 2013 by Manuel Lehner
    permalink
    0 Comments
  • thePicker.columns = null;

    — answered March 12th 2011 by Daniel Arroyo
    permalink
    0 Comments
  • 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);
    
    — answered May 10th 2011 by David Wilson
    permalink
    2 Comments
    • Is the above code only working on iphone?

      — commented April 10th 2012 by Gabor Peto
    • Above code not working iphone.. please any other solution?

      — commented May 9th 2013 by vijaykumar R
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.