我正在使用 ExtJS 4 MVC。
有没有办法每 X 秒重新加载一次 Store?
我想将代码放在Controller
.
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);
在 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
});