0
我想创建一个自定义的选取器,其数据来自远程JSON。问题在于,当我从选取器中选择一行时,它不会在选取器中激发“更改”事件,我必须关闭选取器并再次从选取器中选择一行,然后事件更改将工作。事件更改不会触发动态填充选取器 - 钛SDK
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);
在钛Studio控制台我得到这个:
[WARN][InputManagerService( 60)] Window already focused, ignoring focus gain of: [email protected]
任何想法是怎么回事?
感谢我能在应用程序论坛中找到解决方案,只需在将控件添加到窗口之前触发更改事件即可。 http://developer.appcelerator.com/question/143754/event-change-doesnt-fire-on-dynamically-populated-picker---titanium-sdk – Felix