extjs组合框具有hasone关联属性+可编辑网格

时间:2013-11-12 14:44:11

标签: extjs combobox grid associations

我有一个与BaseInfo模型具有hasone关联的IPIdentifierMod模型

Ext.define('JP.model.IPIdentifierMod', {
extend:'Ext.data.Model',
fields:[
    'enterpriseIdType',
    {
        name: 'referenceVerifiedDate',
        type: 'date',
        convert: function(v, record) {
            return Ext.Date.format((new Date(v)), 'Y-m-d');
            console.log(v);
            console.log(record);
        }
    }
],associations: [
    { type: 'hasOne',
        model: 'BaseInfoMod',
        name:'enterpriseIdType'
    }
]

});

baseInfo:

Ext.define('JP.model.BaseInfoMod', {
extend:'Ext.data.Model',
fields:[
    'typeId',
    'typeName',
    'parentId',
    'priority'
],
proxy: {
    type: 'ajax',
    reader: {
        type: 'json',
        root:'results',
        idProperty: 'typeId'
    },
    api: {
        read : contextPath + '/baseInfo/getBaseInfo'
    },
    extraParams: {
        baseEntityNo: ''
    }
}

});

我在网格中显示IPIdentifierMod数据

显示BaseInfo的naemType的相应网格列是:

    {
    header:'Name Type',
    dataIndex:'enterpriseIdType',
    sortable:true,
    renderer: function(value) {
        return value.typeName;
    }
},

这很好用。 enterpriseIdType.typeName显示在列中。

我现在添加了一个RowEditingPlugin并将以下编辑器添加到此列

        editor: {
        allowBlank: false,
        xtype: 'combobox',
        displayField: 'typeName',
        valueField: 'typeId',
        store: 'EnterpriseIdType',
    }

在编辑器中,字段的值为“[object Object]”。 我需要渲染此对象以显示名称,就像我对实际列一样。 此外,当我在ComboBox中选择一个项目时,不会在数据中创建enterpriseIdType对象, 它只保存valueField中指定的字段的值。 我搜索了它,找到了类似我的问题而没有任何答案。 sencha forum

谢谢

0 个答案:

没有答案
相关问题