我正在尝试创建一个自定义 Picker,其数据来自远程 JSON。问题是,当我从选择器中选择一行时,它不会在第一次触发选择器上的“更改”事件,我必须关闭选择器并再次从选择器中选择一行,然后事件更改才起作用.
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);
在 Titanium Studio 控制台中,我得到了这个:
[WARN][InputManagerService( 60)] Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43f8dbb8
任何想法它正在发生什么?