2012-03-12 42 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