私はこのコントローラーを持っています:
Ext.define('MyApp.controller.Test', {
extend: 'Ext.app.Controller',
config: {
},
refs: [
{
ref: 'first',
selector: '#first'
},
{
ref: 'second',
selector: '#second'
}
],
views : [
'TestMain',
'TestSecond'
],
init: function() {
this.getTestMainView().create();
this.control({
'#first': {
tap: function() {
//how do I go to second view here?
}
},
'#second': {
tap: function() {
}
}
});
}
});
およびこれらの 2 つのビュー:
Ext.define('MyApp.view.TestMain', {
extend: 'Ext.Container',
xtype: 'testmain',
config: {
fullscreen: true,
layout: 'vbox',
scrollable: true,
items: [
{
xtype: 'button',
ui: 'normal',
id: 'first',
text: 'Go To Second Screen',
handler: function() {
//how do I go to second view here?
}
}
]
}
});
...
Ext.define('MyApp.view.TestSecond', {
extend: 'Ext.Container',
xtype: 'testsecond',
config: {
fullscreen: true,
layout: 'vbox',
scrollable: true,
items: [
{
xtype: 'button',
ui: 'normal',
id: 'second',
text: 'Go To First Screen',
handler: function() {
}
}
]
}
});
最初のボタンをクリックすると 2 番目のビューが読み込まれ、2 番目のボタンをクリックするとその逆が読み込まれます。ボタンハンドラーまたはコントロールセクションのいずれかにコードを追加できるようです-両方の例(同じでない限り)と、どちらの方法が最適で、その理由についての説明をいただければ幸いです。
カード レイアウトやタブパネルを使用したくないことに注意してください - あるスタンドアロン ビューから別のビューに切り替える方法を知りたいです (私のアプリにはカード パネルとタブ パネルがあり、ボタンを使用して両方のグループを切り替える必要があります)。
ありがとう!!