2015-09-09 35 views
1

我在使用sencha CMD佈局(mvvm)的web應用程序上使用extjs 5,並希望將商店(用於標籤)綁定到我的視圖網格中的篩選器列表 viewModel存儲定義是:將商店綁定到列表篩選器中extjs 5

stores: { 
    labelContacts: { 
     model: 'myapp.model.label.Contact' 
     , autoLoad: true 
    } // end contact store 
} // end stores 

,並在圖柵格我的列表過濾器代碼

filter: { 
       type: 'list', 
       bind: {store: '{labelContacts}'} 
       labelField: 'DisplayValue', 
       valueField: 'keyId' 
     } 

濾波器的作品,但它不會從綁定的商店顯示的數據,但創造它自己從電網的商店

我錯過了一些東西?

回答

0

我找到了一個解決方法,以獲得綁定的店,但因爲它不是一個真正的優雅的一個,我沒有解決方案滿足,將很高興聽到 我的解決方案正改變着店裏的任何建議:

filter: { 
    type: 'list', 
    store:new myapp.view.main.MainModel().getStore('labelContacts'), 
    labelField: 'label', 
    valueField: 'id' 
} 
0

過濾器通過這些屬性和嘗試這個辦法:

 type: 'list', 
     store: store, // your store 
     labelField: 'DisplayValue', // Your displayValue 
     valueField: 'keyId', // Key Id on which you want to add filter   
+0

我知道一個簡單的過濾器的配置,我想在這裏做的是使用viewModel的綁定存儲 – ezzarghili

0

另一種方法,對我的作品

 { 
      text: 'Yes/No', 
      dataIndex: 'accompanied', 
      filter: { 
       type: 'list', 
      }, 
      listeners: { 
       boxready: function (_this, width, height, eOpts) { 
        _this.filter.store = _this.lookupViewModel().getStore('dicYesNo'); 
       } 
      } 
     }