2012-02-22 45 views
8

我有3個組合框的。當您單擊第一個框時,第二個框需要更新以顯示相關數據。我選擇第一個組合第二個盒子完美更新。但是,如果我嘗試相同的步驟再次第二個框不停止加載(見圖片)extjs組合不會停止加載4.07

enter image description here

這裏是我的看法

{ 
    xtype: 'combobox', 
    name: 'Clients', 
    id: 'clients', 
    displayField: 'Name', 
    store: 'Clients', 
    queryMode: 'local', 
    mode: 'local', 
    valueField: 'Id', 
    fieldLabel: 'Clients' 
},{ 
    xtype: 'combobox', 
    name: 'Projects', 
    id: 'projects', 
    displayField: 'Name', 
    editable: false, 
    store: 'Projects', 
    queryMode: 'local', 
    mode: 'local', 
    valueField: 'Id', 
    fieldLabel: 'Projects' 
} 

,並從我的控制器代碼

stores: ['Projects', 'Clients', 'Jobs'], 

init: function() { 
    this.control({ 
     '#clients': { 
      change: this.onClientSelect 
     }, 
     'processlist button[action=copy]': { 
      click: this.onCopyPart 
     }, 
     '#processColourContainer #processColourGrid': { 
      edit: this.onPurchaseOrderColourUpdate 
     } 
    }); 
}, 

onLaunch: function() {    
    var clients = this.getClientsStore(); 
    clients.load();    
}, 
onClientSelect: function (selModel, selection) { 

    var projects = this.getProjectsStore(); 
    projects.load({ 
     url: '/Projects/Read/?clientId=' + selection, 
     scope: this 
    });  
}, 

回答

3

我發現掛接到上組合了「擴大」事件更好地工作(掛接到在商店「負荷」在某種程度上破壞了組合的結合到商店,造成各種可怕,難以追查的錯誤)。

combo.on('expand', function (field, options) { 
    if (Ext.typeOf(field.getPicker().loadMask) !== "boolean") { 
     field.getPicker().loadMask.hide(); 
    } 
}, this); 

這樣做沒有打破我的申請我的工作。

4

我與ExtJS Combobox的本地數據存儲有相同的症狀,但正確的修復方法是在組合框中正確設置queryMode - 商店中沒有錯誤(至少在4.1版本的ExtJS中)。如果您的數據本地存儲在數據存儲區中(如下面的工作示例所示),queryMode必須設置爲「local」而不是其默認的「remote」值。

組合框:

xtype: 'combobox', 
name: 'sizeMaxUnits', 
value: 'TB', 
editable: false, 
displayField: 'abbr', 
**queryMode: 'local',** 
store: 'UnitsStore', 
valueField: 'units' 

商店:

Ext.define('DiskApp.store.UnitsStore', { 
extend: 'Ext.data.Store', 

requires: [ 
    'DiskApp.model.UnitsModel' 
], 

constructor: function(cfg) { 
    var me = this; 
    cfg = cfg || {}; 
    me.callParent([Ext.apply({ 
     autoLoad: false, 
     model: 'DiskApp.model.UnitsModel', 
     storeId: 'MyStore', 
     data: [ 
      { 
       abbr: 'MB', 
       units: 'M' 
      }, 
      { 
       abbr: 'GB', 
       units: 'G' 
      }, 
      { 
       abbr: 'TB', 
       units: 'T' 
      } 
     ] 
    }, cfg)]); 
} 

});

2

一個非常簡單的解決方案是將listConfig配置添加到您的組合框:

{ 
    xtype:'combobox', 
    fieldLabel: 'My Combo', 
    listConfig: { loadingText: null, loadMask: false }, 
}