0
您好我是sencha touch2的新手,在一個容器中,我在右側顯示左側列表和詳細視圖。現在想要顯示列表中已粘貼項目文本的詳細布局。 這裏是我的看法。Sencha Touch2:容器內部的列表和詳細面板與佈局盒vbox
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');
}
});
我怎樣才能做到這一點?誰能幫幫我嗎 ?謝謝。所有的
您是否在控制器中添加了引用,並且組件是上面定義的引用?參考文獻是指具有id'myDetail'的組件。 – SachinGutte
一個正確的答案,仍然downvote。 :( – SachinGutte
其工作表示感謝。如何添加獨立面板(我的意思是說不同的屏幕),而不是列表項上的文字點擊? – chipmunk