将自动完成组合框与extjs一起使用

将自动完成组合框与extjs一起使用,extjs,extjs4,Extjs,Extjs4,我的例子是,我有一个编辑表单,它从网格的选定行获取数据。 在此表单中,有一些类型为“combobox”的字段,我正在使用自动完成属性: xtype: 'combobox', store: 'Paciente', forceSelection: true, typeAhead: true, pageSize: 10, fieldLabel: 'Paciente', name: 'paciente_id', valueField: 'i

我的例子是,我有一个编辑表单,它从网格的选定行获取数据。 在此表单中,有一些类型为“combobox”的字段,我正在使用自动完成属性:

    xtype: 'combobox',
    store: 'Paciente',
    forceSelection: true,
    typeAhead: true,
    pageSize: 10,
    fieldLabel: 'Paciente',
    name: 'paciente_id',
    valueField: 'id',
    displayField: 'nome',
    allowBlank: false,
    afterLabelTextTpl: required
这是我的商店:

Ext.define('App.store.Paciente', {
  extend: 'Ext.data.Store',
  model: 'App.model.Paciente',
  pageSize: 10,
  proxy: {
      type: 'rest',
      format: 'json',
      url: 'pacientes',
      reader: {
          root: 'pacientes',
          totalProperty: 'totalCount'
      }
  }
});
当使用组合时,它可以工作。但是,当我在网格中选择一行时,所有字段都会被填充,但组合不会被填充

gridSelectionChange: function(model, records) {
    if (records[0]) {
        this.getForm().load(records[0]);
    }
},
加载表单时,如何正确填写此组合

更新1:工作代码

我必须为每个组合框手动执行此操作。我认为那是一种自然而然的方式

if (records[0]) {
        this.getForm().loadRecord(records[0]);

        //updating current value for combo paciente 
        this.getStore('Paciente').add({nome: records[0].get('nome'), id: records[0].get('id')});
        this.getCombopaciente().select(records[0].get('paciente_id'));

        //updating current value for combo XYZ...
    }

默认情况下,combo仅在展开时加载存储。在您的情况下,它没有要显示的数据。
您可以手动调用storeload方法或在组合配置中设置autoload属性

但是这个自动加载会加载什么呢?整张桌子?我真的需要它只加载id为的记录。有些表包含数千条记录,如下图所示。您已经为存储定义了reader。如我所见,它从“pacientes”url读取数据。不是吗?如果您想手动添加,请参阅存储添加方法Hi Prodigy,请参阅我的更新1。谢谢。我只能告诉你们,你们可以从你们的组合框组成数组,并在数组上行走。类似于:
combo.store.add({combo.displayField:records[0].get(combo.displayField),id:records[0].get('id')})