我尝试了一些不同的方法,但无法将数据从控制器传递到视图(传递到容器内的组件)。
在这里,我有视图ServisDetail.js:
Ext.define('Asistan.view.ServisDetail', {
extend: 'Ext.Container',
xtype: 'servisDetail',
config: {
layout: 'fit',
items : [
{
xclass : 'Asistan.view.ServisToolbar'
},
{
// "data: {}" is needed to work. I try to pass data from controller to here
xtype: 'component',
tpl: Ext.create('Ext.XTemplate','{URUN_CIHAZ_ADI} jkjk')
}
]
}
});
这是我的控制器Servis.js思考认为它应该工作。但它不传递数据:
Ext.define('Asistan.controller.Servis', {
extend: 'Ext.app.Controller',
config: {
refs: {
servis: 'servisNavigationView servisContainer list',
},
control: {
servis: {
itemdoubletap: 'showServis'
}
}
},
showServis: function(item, index, e, eOpts) {
this.servis = Ext.widget('servisDetail');
this.servis.config.items[1].data = eOpts.data; // <- Here! It doesn't work. console.log shows that the data is there but in the browser the data doesn't show up.
console.log(this.servis.config.items[1].data); // I can see my data here, right before the push
item.up('servisNavigationView').push(this.servis);
}
});
我错过了什么?