2011-08-02 19 views
0

我有一個問題觸發「負荷」和EXT4對商店的beforeload「事件:ExtJS的4不能觸發店內活動負載和beforeload

Ext.define('Emvr.store.saveFormData', { 
     extend: 'Ext.data.Store', 
     model: 'Emvr.model.saveFormData', 
     constructor: function(config) { 
      config = config || {}; 
      this.callParent([config]); 
     } 
    }); 
    var store_myVisitsGrid_instance = new Emvr.store.saveFormData(); 


    store_myVisitsGrid_instance.on(load, function() { 
       alert('ok load'); 
    }) 

它不會進入功能時,我加載數據使用

store_myVisitsGrid_instance.loadData(responseFromServer) 
+0

你是否看到任何錯誤?你可以發佈他們嗎? – laurac

+0

我沒有錯誤。 – lucian

+0

我可以在firebug中看到我爲load事件定義了一個監聽器,但是函數內部的動作沒有被觸發 – lucian

回答

1

loadData觸發load事件。 load方法。

+0

好吧,這是ext 4的新增功能,與3.x稍有不同,loadData方法是也觸發負載事件。現在,我正在從文檔中讀取的加載事件「每當記錄被預取時觸發」。你知道預取方法有效嗎?我通過一個ajax請求加載了一堆商店,並且我使用loadData來填充每個商店。對於一個特定的商店,我需要知道何時加載記錄才能執行一些自定義代碼。你知道這個解決方法嗎? – lucian

4

爲此,我能夠使用datachanged事件。

我挖掘了源代碼並發現loadData方法最終會觸發datachanged事件。這在舊的ext 3.x上沒有發生。