2

我正在使用 ExtJS 4 MVC。

有没有办法每 X 秒重新加载一次 Store?

我想将代码放在Controller.

4

2 回答 2

6
setInterval(function(){
    // Use Ext.getStore to reference your store from the controller
    var myStore = Ext.getStore('YourStore');
    // Pass in an object of the changes you want to be made to the store
    myStore.proxy.extraParams = { key:'sencha'}; // replace with your own object
    myStore.load();

},3000);
于 2013-01-19T11:15:46.037 回答
1

在 Extjs 中仅供参考,这可以通过Ext.util.TaskRunner来实现。示例代码:

var runner = new Ext.util.TaskRunner(),
clock, updateClock, task;

clock = Ext.getBody().appendChild({
    id: 'clock'
});

// Start a simple clock task that updates a div once per second
updateClock = function() {
    clock.setHtml(Ext.Date.format(new Date(), 'g:i:s A'));
};

task = runner.start({
    run: updateClock,
    interval: 1000
});
于 2016-11-08T12:51:03.093 回答