2016-10-11 19 views
0

我有一個格子店,看起來像這樣:無法獲得電網儲存過濾器

Ext.create('Ext.data.BufferedStore', { 
    fields: fields, 
    autoLoad: true, 
    leadingBufferZone: 300, 
    pageSize: 100, 
    proxy: { 
     type: 'ajax', 
     url: 'handler.php?action=getObjData&id_obj='+id_bj, 
     reader: { 
      type: 'json', 
      rootProperty: 'items', 
      totalProperty: 'total' 
     } 
    }, 
    listeners: { 
     load: function() { 
      //this is what I tried 
      console.log(this.proxy.extraParams); 
      console.log(this.proxy.params); 
      console.log(this.proxy.url); 
      console.log(this.filters.filterData()); 
     } 
    } 

});

正如你所看到的,在一個負載監聽器中,我嘗試了許多解決方案。但是,所有這些導致undefined{}或初始網址,事件雖然wnen我過濾數據,我在控制檯中看到,服務器的請求成爲的樣子:

handler.php?action=getObjData&filter=[{"operator":"gt","value":0,"property":"attr_88186_"}]... 

所以,有一個過濾器參數,但我無法得到它。

+0

您是否嘗試過使用煎茶文檔的功能呢? –

+0

是的。我發現了'filterData()'函數,就像你在我的例子中看到的那樣,但是仍然失敗了。 – Jacobian

+0

我的意思是,你能寫出你的控制檯日誌的結果嗎? url控制檯日誌返回url還是不? –

回答

3

你想從商店得到的過濾器:

load: function (store) { 
    var filters = store.getFilters().getRange() 
+0

謝謝!有用。雖然'getRange'對這項任務聽起來不太合適。他們可以選擇一個更好的方法名稱。但是,謝謝! – Jacobian

+0

'filters'是一個'mixedCollection','getRange(start; end)'是'mixedCollection'的方法來獲得一定的範圍(默認開始默認爲0,默認爲集合中的條目數),所以它有道理,海事組織。他們可以將'filters'重命名爲'filtersCollection',但是他們沒有,因爲向後兼容。 – Alexander