【发布时间】:2011-11-17 20:08:30
【问题描述】:
我正在尝试向以下内容添加一个侦听器,但它不会触发
plugins: [{
ptype: 'pullrefresh',
autoPaging: true,
listeners: {
'released': function(plugin,list){
// call the plugins processComplete method to hide the 'loading' indicator
/* your_store.on('load', plugin.processComplete, plugin, {single:true});
// do whatever needs to happen for reload
your_store.load();*/
alert('test');
}
}
}],
我想要做的是有人在触发刷新事件时拉出列表,我们获取用户纬度和经度并将值加载到商店中。我的问题是存储前加载:事件没有正确地事件气泡,因此在获取用户地理位置之前它会触发存储 json 调用。
My Store{
listeners: {
beforeload: function(){
console.log( 'me1' );
//call this to write to location services on device
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
console.log( 'me2' );
Rad.stores.games.getProxy().extraParams.lat = position.coords.latitude;
Rad.stores.games.getProxy().extraParams.long = position.coords.longitude;
});
}
console.log( 'me3' );
}
}
}
如果您查看控制台,它会显示 me1,me3,me2.... 我希望它显示 me1,me2,me3。
我确实查看了所有论坛、文档,但我猜只需要一些关于设置侦听器和事件冒泡的指导。谢谢你。
【问题讨论】:
-
很高兴您找到了答案,但您能否将其添加为答案(如下)而不是对您的问题进行编辑?等待一段时间后,您将被允许选择正确,这将结束您的问题。这有点奇怪,但我们就是这样做的。谢谢。
标签: sencha-touch extjs