Refreshing picker data - picker.reloadColumn or something else?

You must Login before you can answer or comment on any questions.

Using 1.1.2 I've got a picker working in the iPhone simulator. I am now trying to change the picker data after a button click but can't seem to get it to work.

I see picker.reloadColumn in the API doc, but no example and I haven't been able to figure it out.

Is this working yet? If so, how should I be calling it? If not, is there any other way to reset picker data?

Thanks for any help

4 Answers

I have this function to remove picker data:

var removeAllPickerRows = function(picker) {
    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);
        }
    }
};

i cant understand that. its possible to add Data but no way to remove... pls.. why?

Well, minutes after asking this I found what I think works. Even though the picker already exists, if I just call

picker = Ti.UI.createPicker();

again, then set all the data as before, this seems to accomplish what I want. Not as elegant as just refreshing the data, but if it works, it works.

I am still curious about refreshing the data if anyone knows.

As I can see, reloadColumn was deprecated and there is no way to dynamically change the content of the picker's second column based on the choice in the first one. The method to write "picker = Ti.UI.createPicker();" does not work either.. The reason is: The change event listener does not work on the newly created picker instance. You can only get the event listener work once, on the original picker instance. Can anyone comment on this?

— answered 1 year ago by Taner Girgin
answer permalink
1 Comment
  • It appears that reloadColumn was not deprecated but it is for iPhone only and does not work for Android...

    — commented 1 year ago by Taner Girgin

Your Answer

Think you can help? Login to answer this question!