2012-03-12 38 views
0

我正在使用ExtJS MVC並實現Scheduler。combobox的值不在extjs中加載MVC

我想在我的組合框中加載我的商店,但未成功加載。

我的店是

Ext.define('gantt.store.serviceStore', { 
    extend: 'Ext.data.Store', 
    model: 'gantt.model.Service', 
    storeId: 'serviceStore', 
    autoLoad: true, 
    autoSync: true, 
    proxy: { 
     type: 'ajax', 
     api: { 
      read: 'Event/Get' 
     }, 
     reader: { 
      type: 'json', 
      root: 'data' 
     }, 
     writer: { 
      type: 'json', 
      encode: true, 
      writeAllFields: true, 
      root: 'data' 
     } 
    } 
}); 

我的模型是

Ext.define('gantt.model.Service', { 
    extend: 'Sch.model.Event', 
    fields: [{ name: 'ServiceId' }, 
     { name: 'ServiceName' }, 
     { name: 'Description' }, 
     { name: 'Rate' } 
     ], 
    proxy: { 
     type: 'ajax', 
     api: { 
      read: 'Service/Get' 
     }, 
     reader: { 
      type: 'json', 
      root: 'data' 
     }, 
     writer: { 
      root: 'data', 
      type: 'json', 
      encode: true, 
      writeAllFields: true 
     } 
    } 
}); 

和我的組合框代碼如下..

this.combo = new Ext.form.ComboBox({ 
    id: 'statesCombo', 
    store: 'serviceStore', 
    displayField: 'ServiceName', 
    valueField: 'ServiceName', 
    hiddenName: 'ServiceId', 
    typeAhead: true, 
    mode: 'local', 
    fieldLabel: 'Services', 
    anchor: '100%', 
    forceSelection: true, 
    triggerAction: 'all', 
    emptyText: 'Select a Service', 
    selectOnFocus: true }) 

我的問題是,當我點擊在組合框上我的價值是沒有加載.. 並沒有顯示任何錯誤。

+0

你看到通信嘗試到您的服務器? – sha 2012-03-13 20:45:46

+0

其實我正在創建調度程序,但是當我點擊組合框時,它會調用**事件獲取**而不是**服務獲取**。它不會與服務器 – Smily 2012-03-14 06:46:15

回答

1

你錯過了「名」選項...就像這樣:

名稱:「服務名稱」,

+0

正確交互感謝cujo37我得到了解決方案。 – Smily 2012-04-04 09:21:21