Ich versuche im unteren abgekürzten Code-Beispiel in var ArticleName Zugriff zu erhalten auf die Variable md_variation, die zuvor gesetzt wurde.
Wie komme ich da dran ?
Ext.override(Shopware.apps.Order.view.detail.Position, {
getColumns: function() {
var me = this;
var columns = me.callOverridden(arguments);
var md_upload = {};
var response = {};
var ID = null;
var MDUPload= {
header: 'xy',
dataIndex:'xy',
flex: 3,
renderer: function(value, metadata, record, rowIndex, colIndex, store, view){
var dataRow ='';
var md_variation = {};
Ext.Ajax.request({
url: '{url controller=AttributeData action=loadData}',
params: {
_foreignKey: record.get('id'),
_table: 's_order_details_attributes',
},
async:false,
success: function(responseData) {
ID = Ext.JSON.decode(response.data['__attribute_detailID']);
if ( !isNaN( parseFloat(ID)))
{
md_variation[ID] = Ext.JSON.decode(response.data['__attribute_md_variation']);
}
}
});
return dataRow;
}
};
var ArticleName = {
header: 'Artikel',
dataIndex: 'articleName',
flex: 2,
renderer: function(val, metadata, record) {
var variationRow='';
if ( !isNaN( parseFloat(record['raw']['id'])))
{
for(var i=0; i < md_variation[record['raw']['id']].length;i++)
{
variationRow +=md_variation[record['raw']['id']][i]['name']+':'+md_variation[record['raw']['id']][i]['value']+'';
}
}
return variationRow;
}
};
columns = Ext.Array.insert(columns, 8, [MDUPload]);
columns = Ext.Array.remove(columns,1);
columns = Ext.Array.insert(columns,1, [ArticleName]);
return columns;
}
});