Значение combobox не загружается в extjs MVC - PullRequest
0 голосов
/ 12 марта 2012

Я работаю с 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
        }
    }
});

, а мой код ComboBox указан ниже ..

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   })

Моя проблема возникает, когда яam Нажмите на поле со списком, мое значение не загружено .. и не отображает никаких ошибок.

1 Ответ

1 голос
/ 28 марта 2012

Вам не хватает опции "имя" ... Вот так:

имя: 'ServiceName',

...