定义一个Window类:
Ext.define('com.test.loader.Window',{
title:"loader Window1 Test",
extend:'Ext.window.Window',
width:430,
height:260,
initComponent:function(){
this.callParent(arguments);
}
});
//创建一个窗口,继承自上面的com.test.loader.Window
Ext.define('com.test.loader.FormWindow',{
title:"loader Window1 Test",
extend:'com.test.loader.Window',
width:230,
height:160,
//items:[],
constructor: function(cfg) {
this.initConfig(cfg);
}
});
测试加载:
jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>requires LoaderTest1 </title>
<jsp:include page="../include/ext-core-top.jsp" flush="true">
<jsp:param value="../" name="basePath" />
</jsp:include>
<script type="text/javascript" src="LoaderTest1.js"></script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
加载目录当前目录下的window包,包名
com.test.loader
Ext.Loader.setConfig({
enabled:true,
paths:{}
});
Ext.Loader.setPath('com.test.loader','./window');
Ext.onReady(function(){
title:'窗口2 组件测试'
})
//创建一个类,继承自com.test.loader.Window
title:'异步加载组件测试',
items:[{
xtype:'button',
text:'显示窗口',
handler:function(){
win2.show();
}
}]
}).show();
});