2013-03-06 93 views
3
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秒刷新JSON商店的每60秒 - EXT JS 4

回答

3

我只是使用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有更多的數據。