MVC形式に従う:
意見:
Ext.define('MyApp.view.FirstScreen', {
extend: 'Ext.Panel',
config: {
items: [
{
xtype: 'textfield',
itemId: 'textField1',
label: 'Field'
},
{
xtype: 'textfield',
itemId: 'textField2',
label: 'Field'
},
{
xtype: 'button',
itemId: 'mybutton1',
text: 'click me'
},
{
xtype: 'titlebar',
docked: 'top',
title: 'First Screen'
}
]
}
});
// Client List (Second Screen)
Ext.define('MyApp.view.ClientList', {
extend: 'Ext.Panel',
alias: 'widget.clientlist',
config: {
itemId: 'clientList',
items: [
{
xtype: 'titlebar',
docked: 'top',
title: 'Client List'
}
]
}
});
コントローラ:
Ext.define('MyApp.controller.MyController1', {
extend: 'Ext.app.Controller',
config: {
refs: {
textField1: '#textField1',
textField2: '#textField2',
clientList: {
autoCreate: true,
selector: '#clientList',
xtype: 'clientlist'
}
},
control: {
"button#mybutton1": {
tap: 'onMybutton1Tap'
}
}
},
onMybutton1Tap: function(button, e, options) {
var me = this,
clientList = me.getClientList(),
textField1_val = me.getTextField1().getValue(),
textField2_val = me.getTextField2().getValue();
Ext.Viewport.animateActiveItem(clientList,{ type:'flip'});
// Do what you need to do with the values from your
// first screen in your client list
clientList.setHtml('textField1_data: '+textField1_val+'<br>textField2_data: '+ textField2_val);
}
});