嗨,我是 sencha touch2 的新手,在容器中,我在左侧显示列表,在右侧显示详细视图。现在想用列表的单击项文本显示详细布局。这是我的观点。
Ext.define('TestApp.view.VboxEx',{
extend:'Ext.Container',
xtype:'vbox_ex',
requires:['Ext.dataview.List'],
config:{
layout:{
type:'hbox'
},
items:[
{
docked:'top',
xtype:'titlebar',
title:'Vertical box'
},
{
xtype: 'list',
id: 'mylist',
flex:1,
docked: 'left',
style:'background-color:lightgreen',
store: 'Training_data',
pinHeaders: false,
width: 331,
itemTpl: [
'{name}'
]
},
{
xtype:'component',
flex:3,
id: 'myDetail',
html:'Flex3',
style:'background-color:lightyellow'
}
]
}
});
这是我的控制器:
Ext.define('TestApp.controller.MyController', {
extend: 'Ext.app.Controller',
config:{
refs: {
listView: '#mylist'
},
control: {
'listView': {
itemtap: 'onItemTap'
}
}
},
onItemTap: function(view, index, target, record, event) {
console.log('Item was tapped on the Data View');
var record = view.getStore().getAt(index);
var selectdValue = record.get('name');
console.log('Selceted Item index: '+index);
console.log('Selceted Item value: '+selectdValue);
// here how can i change the text(selected value) in my detail panel ?
},
onLaunch: function () {
console.log('onLaunch');
}
});
我怎样才能做到这一点?谁能帮帮我吗 ?谢谢。