我正在开发 sencha2.0。我有一个登录表单,我想通过单击登录表单中的提交按钮来调用另一个表单。
Ext.define('senchaApp.view.test', {
extend : 'Ext.form.Panel',
xtype : 'test',
requires: "Ext.form.FieldSet",
id : 'login',
layout:'vbox',
constructor : function(config) {
var formContainer = Ext.create('Ext.Panel',{
width:'100%',
height:'100%',
id:'formPanel',
flex:1,
items:[{
xtype:'textfield',
name:'user',
id:'user',
label:'Username',
clearIcon:false,
cls:'fields'
},
{xtype:'passwordfield',
style:'margin-top:10px;',
name:'pass',
id:'pass',
label:'Password',
clearIcon:false,
cls:'fields'
},
{xtype:'button',
cls:'submitBtn',
id:'submit',
ui:'action-small',
action:'submitLogin',
style:'background-image: url("app/resources/images/img_btnStrip.png");width:186px;margin: 0 auto;height:66px;margin-top:20px;background-color:none;'
}]
});
var formContentHolder = Ext.create('Ext.Panel',{
cls:'middleContainer',
items:[formContainer]
});
config.items = [formContentHolder];
this.callParent(arguments);
},
initialize : function() {
this.callParent(arguments);
}
});
在控制器下有 Main.js,一个疑问是 ref 和 refs 的选择器下应该有什么:
Ext.define('senchaApp.controller.Main',{
extend:'Ext.app.Controller',
refs:[{
ref:'',
selector:''
}],
init: function(){
Ext.create('senchaApp.view.Viewport');
this.control({
'#submit':{
tap: this.showanotherform
}
});
},
showanotherform: function(){
//How I will call another form on click of submit button here
}
});