2012-01-31 80 views
0

我正在試驗ExtJS 4 Combobox AJAX Store中的一個bug。Sencha ExtJS 4 Linked Combobox問題

我有篇網格,每個文章供應商類別,屬於一定類別中的每個供應商報價文章。爲了過濾網格我已經把2 Combos(選擇列表)。一個用於供應商和一個用於類別。這些組合通過AJAX從php腳本獲取它們的值。

一切順利,直到我試圖把連擊鏈接是這樣的:

當用戶從組合框中選擇一個類別,則供應商商店刷新與供應商,提供該類別(工作正常!) 。

的用戶選擇了一個商組合框,以及類別存儲刷新(刷新是好的,與螢火蟲看到的)。

現在我的問題是,如果用戶再次選擇類別組合框,那麼加載掩碼不會消失,因此它無法更改組合值。

我測試過了,AJAX工作正常,這只是EXTJS 4與加載掩碼有關的問題。

問題是發生雙向的:

A)

1.用戶選擇類別

2.用戶選擇的供應商

3。用戶不能選擇一個類別(加載掩碼不去Y)

AND

B)

1.用戶選擇的供應商

2.用戶選擇類別

3。用戶不能選擇一個供應商(裝面膜不會消失)

編輯:

這個問題似乎對這些情況(反之亦然:供應商 - >類)也發生

1.用戶選擇類別

2.用戶改變類別

用戶不能選擇一個供應商(裝面膜不會消失)

這裏是我的模型:

Ext.define('Category', { 
     extend: 'Ext.data.Model', 
     fields: [ 
      { name: 'name'}, 
      { name: 'id'} 
     ] 
    }); 

    Ext.define('Supplier', { 
     extend: 'Ext.data.Model', 
     fields: [ 
      { name: 'name'}, 
      { name: 'id'} 
     ] 
    }); 

這裏是我的店:

var categoryStore = Ext.create('Ext.data.Store', { 
     model: 'Category', 
     autoLoad: true, 
     remoteSort: true, 
     proxy: { 
      type: 'ajax', 
      url: 'GetCategorysForSupplier', 
      reader: { 
       type: 'json', 
       root: 'items' 
      }, 
      extraParams: { 
       supplier: 0 
      } 
     } 
    }); 

    var supplierStore = Ext.create('Ext.data.Store', { 
     model: 'Supplier', 
     autoLoad: true, 
     remoteSort: true, 
     proxy: { 
      type: 'ajax', 
      url: 'getSuppliersForCategory.php', 
      reader: { 
       type: 'json', 
       root: 'items' 
      }, 
      extraParams: { 
       category: 0 
      } 
     } 
    }); 

而且這裏是我的組合:

var categoryFilterCombo = Ext.create('Ext.form.field.ComboBox', { 
     xtype: 'combo', 
     store: categoryStore, 
     displayField: 'name', 
     valueField: 'id', 
     fieldLabel: 'Category Filter', 
     listeners: { 
      change: function(field,newVal) { 
       if (Ext.isNumeric(newVal)) { 
        supplierStore.proxy.extraParams.category = newVal; 
        articleStore.proxy.extraParams.category = newVal; 
        supplierStore.load(); 
        articleStore.load(); 
       } 
      } 
     } 
    }); 

    var supplierFilterCombo = Ext.create('Ext.form.field.ComboBox', { 
     store: supplierStore, 
     displayField: 'name', 
     queryMode: 'local', 
     valueField: 'id', 
     fieldLabel: 'Supplier Filter', 
     listeners: { 
      change: function(field,newVal) { 
       if (Ext.isNumeric(newVal)) { 
        categoryStore.proxy.extraParams.supplier = newVal; 
        articleStore.proxy.extraParams.supplier = newVal; 
        categoryStore.load(); 
        articleStore.load(); 
       } 
      } 
     } 
    }); 

親切的問候,

丹Cearnau

回答