gpt4 book ai didi

javascript - 每 60 秒刷新一次 JSON 存储 - EXT JS 4

转载 作者:行者123 更新时间:2023-11-29 10:48:16 27 4
gpt4 key购买 nike

    var MarkerStore = Ext.create('Ext.data.JsonStore', {
model: 'GoogleMarkerModel',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'get-googlemarker.php',
baseParams: { //here you can define params you want to be sent on each request from this store
mainid: 'value1'
},
reader: {
type: 'json',
idProperty:'MainID',
}

}
});

setTimeout(MarkerStore, 60000);

这是正确的吗?因为我仍然无法每 60 秒获取任何新数据

最佳答案

我只是使用 javascript setInterval 函数。 Sencha 在他们的 livegrid 中使用了这个示例。

例如:

// reload the stores once and then repeatedly every 60 seconds
MarkerStore.load();
setInterval(function() {
MarkerStore.load();
}, 60000);

要获得更完整的答案,您使用的 setTimeout javascript 函数仅在指定的毫秒数后执行一次代码。 setInterval 就是你要重复执行的一个函数

另请注意,setIntervalsetTimeout 的第一个参数都是 javascript 函数。在上面的代码片段中,您将商店对象本身作为第一个参数传递,这根本不会导致它被调用。 This page有更多数据。

关于javascript - 每 60 秒刷新一次 JSON 存储 - EXT JS 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15238289/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com