Ext.onReady(function(){
Ext.namespace("lease.panel");
//框架 : lease.panel.paneledit = Ext.extend(Object,{});
//提供公用面板展示
lease.panel.paneledit = Ext.extend(Object,{
init:function(){
//所有要用到的表单项
this.nameEdit = new Ext.form.TextField({
fieldLabel:"测试"
});
this.bt = new Ext.Button({
text:"测试oop",
handler:function(){
lease.panel.fun.edit();
}
});
},
//提供对外展示
ShowEditForm:function(){
//方法使用this.xx来访问
this.init();
var newWin = new Ext.Window({
layout : 'fit',
width : 600,
bodyStyle:'padding:5px;',
autoHeight:true,
buttonAlign:'center',
closeAction : 'hide',
iconCls:'editpage',
constrain:true,
maximizable:true,
plain:true,
modal:true,
title : '新增xx',
listeners:{
"hide":function(){
alert("隐藏事件");
},
"show" : function() {
alert("显示事件");
}
},
items : this.nameEdit, //注意使用this.xx 来访问
buttons:[
this.bt,
new Ext.Button({
text:"取消",
tooltip:'关闭窗口',
iconCls : 'cancel',
handler: function(){
newWin.hide();
}
})
]
});
newWin.show();
}
});
//所有用到的函数(类似于java的工具类)
//框架: lease.panel.fun = function(){
// return{
//
//
// }
// }();
lease.panel.fun = function(){
//私有
function edit1(){
alert("编辑成功")
}
//对外提供
return{
test:function(s){
alert(s);
},
edit:function(){
//调用私有
edit1("我是私有方法外部无法访问");
//调用共有
this.test("我是共有方法,外部访问方法:lease.panel.fun.edit()");
}
}
}();
});