2017-03-06 94 views
2

我想要在编辑器功能中选择一些东西的网格中得到一个combox。但每次渲染值为0。保存后它可以正常工作。ExtJs Combox不能正确渲染

Ext.define('Shopware.apps.Order.view.detail.BackPosition', { 
override: 'Shopware.apps.Order.view.detail.Position', 

initComponent: function() { 
    var me = this; 
    me.mdsupplierStore = Ext.create('Shopware.apps.Order.store.MDSupplier').load(); 
    me.callParent(arguments); 

}, 

getColumns: function(grid) { 
    var me   = this; 

    var col  = me.callOverridden(arguments); 
    var md_supplier = {}; 
    grid.mdsupplierStore = me.mdsupplierStore; 

    var MDSupplier= { 
     header: 'Lieferant', 
     dataIndex: 'md_supplier', 
     flex:2, 
     renderer: me.supplierColumn, 
     editor: { 
      xtype: 'combobox', 
      editable: false, 
      queryMode: 'local', 
      allowBlank: false, 
      store: grid.mdsupplierStore, 
      displayField: 'name', 
      valueField: 'id', 

     } 

    }; 


    col = Ext.Array.insert(col, 9, [MDSupplier]); 
    return col; 
}, 

supplierColumn: function(value, metaData, rowRecord) { 

    var me = this; 
    console.log(value); 
    //value is 0 when I click the editor combobox <--- 
}, 

});

型号:

Ext.define('Shopware.apps.Order.model.MDSupplier', { 
    extend:'Shopware.data.Model', 

idProperty : 'id', 

fields:[ 

    { name : 'id', type: 'int'}, 
    { name : 'name', type: 'string'} 
] 

});

商店:

Ext.define('Shopware.apps.Order.store.MDSupplier',{ 
configure: function() { 
    return { controller: 'MDSupplier' }; 
}, 
/** 
* Define that this component is an extension of the Ext.data.Store 
*/ 
extend: 'Ext.data.Store', 

/** 
* Auto load the store after the component 
* is initialized 
* @boolean 
*/ 
autoLoad: false, 

/** 
* Define the used model for this store 
* @string 
*/ 
model: 'Shopware.apps.Order.model.MDSupplier', 

proxy : { 
    type : 'ajax', 
    url: '/backend/MDSupplier/load', 

    reader:{ 
     type: 'json', 
     root: 'data', 
     totalProperty: 'total' 
    } 
} 

});

有人可以告诉我,我做错了什么?

+0

由于您的值来自商店,因此请提供您加载到商店中的数据。 – Alexander

回答

0

我明白了。数据处理错误,因此该字段每次都是NULL