----app--------
Ext.Loader.setConfig({
enabled:true
});Ext.application({
name: 'esbApp',
appFolder: 'scripts',
autoCreateViewport: true,
models: ['SysUserInfo'],
stores: ['FrameMenus','SysUserStore'],
controllers: ['FrameMenu','SysUserCtrl'],
launch: function() {
setTimeout(function() {
Ext.get('loading').remove();
Ext.get('loading-mask').fadeOut({
remove : true
});
}, 1000);
}
});----controller--------
Ext.define('esbApp.controller.SysUserCtrl',{
extend: 'Ext.app.Controller',
views: ['SysUserEdit'],
//refs:[{ref:'SysUserEdit', selector: 'sysuseredit'}],
init: function() {
console.log('init...');
this.control({
'sysuseredit button[action=save]': {
click: this.saveSysUser
}
});
},
saveSysUser: function(button) {
console.log('clicked the Save button');
}
});
Ext.Loader.setConfig({
enabled:true
});Ext.application({
name: 'esbApp',
appFolder: 'scripts',
autoCreateViewport: true,
models: ['SysUserInfo'],
stores: ['FrameMenus','SysUserStore'],
controllers: ['FrameMenu','SysUserCtrl'],
launch: function() {
setTimeout(function() {
Ext.get('loading').remove();
Ext.get('loading-mask').fadeOut({
remove : true
});
}, 1000);
}
});----controller--------
Ext.define('esbApp.controller.SysUserCtrl',{
extend: 'Ext.app.Controller',
views: ['SysUserEdit'],
//refs:[{ref:'SysUserEdit', selector: 'sysuseredit'}],
init: function() {
console.log('init...');
this.control({
'sysuseredit button[action=save]': {
click: this.saveSysUser
}
});
},
saveSysUser: function(button) {
console.log('clicked the Save button');
}
});
Ext.define('esbApp.view.SysUserEdit',{
extend: 'Ext.form.Panel',
alias: 'widget.sysuseredit',
initComponent: function() {
this.title = '用户新增',
this.height = 300,
this.width =400,
this.url = '',
this.bodyPadding = 5,
this.layout = {
type: 'vbox',
baseCls : "x-plain",
align: 'center'
},
this.defaultType ='textfield',
this.blankText ='该项不能为空!',
this.items = [{
fieldLabel: '名称',
name: 'sysUserName',
allowBlank: false
},{
fieldLabel: '用户名',
name: 'userName',
allowBlank: false
},{
fieldLabel: '密码',
name: 'password',
allowBlank: false
},{
xtype: 'button',
text: '提交',
width: 80,
action: 'save',
formBind: true,
action: 'save',
url: 'demo/saveSysUser.action',
handler: function(){
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success');
},
failure: function(form, action) {
Ext.Msg.alert('Failed');
}
});
}
}
}];
this.callParent();
}
});
-----tabpanell----if (record.get('leaf')) {
var panel = Ext.getCmp(record.id);
if(!panel){
panel = {
title: record.get('text'),
iconCls: 'treeNodeLeafIcon',
html: '<iframe id="iframe_'+record.id+'" src="'
+ '/'
+ getAppName()
+ record.data.url
+' " width=100% height=100% marginwidth="0" framespacing="0" marginheight="0" frameborder="0" ></iframe>',
closable: true
};
//test();
openTab(panel,record.id);
.....
this.control({
'sysuseredit > button': {
click: this.saveSysUser
}