I'm trying to create a custom Picker whose data is from a remote JSON. The problem is that it doesn't fire the 'change' event on the picker at the first time when I select a row from the picker, I have to close the picker and select a row from the picker again and then the event change works.
var clubs_data = []; //custom object to handle the httpClient new K().scoutmobile.Tools.getData(new K().scoutmobile.URL_BASE, {Accion:new K().scoutmobile.CLUBS}, function(_response){ if(response.status.codigo === "RESULT"){ clubs_data.push(Ti.UI.createPickerRow({title:'select a club'})); for(_j in _response.data){ clubs_data.push(Ti.UI.createPickerRow({color:'#fff',title: _response.data[_j].Propiedades.club_nombre.Valor, id:_response.data[_j].Propiedades.club_id.Valor})); inputClubs.add(clubs_data); //where inputClubs is created previously }else{ new K().scoutmobile.Tools.createDialog('invalid_user_alert_dialog_title','invalid_user_alert_dialog_message'); } }); //event listener inputClubs.addEventListener('change', function(e){ Ti.API.info(e.row.id); }); win.add(inputClubs);In the Titanium Studio Console I get this:
[WARN][InputManagerService( 60)] Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43f8dbb8Any ideas what it is happening?
1 Answer
Accepted Answer
Have you tried firing the event manually when the app starts?
Put this just before the win.add line:
inputClubs.fireEvent('change');
Your Answer
Think you can help? Login to answer this question!