2012-01-31 79 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

回答