Extjs4 -- Ext.loader命名空间的配置
初次使用extjs4的版本,在配置学习Ext.Loader()进行js文件的动态加载机制,由于各种原因导致多次失败,纠结2天,现将解决时出现的问题及需要注意事项进行记录
开发环境myeclipse8.5,tomcat6.
目录结构:
WebRoot
-->02(文件夹)
-->createWindow.js
-->createWindow.html
-->ux(文件夹)
-->window.js
createWindow.html中,引入ext环境文件(ext-all.css,bootstrap.js),引入createWindow.js文件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>extjs--创建window</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../extjs-4.1.1/resources/css/ext-all.css">
<script type="text/javascript" src="../extjs-4.1.1/bootstrap.js"></script>
<script type="text/javascript" src="createWindow.js"></script>
</head>
<body>
</body>
</html>
createWindow.js
(function(){
Ext.Loader.setConfig({
enabled:true,
paths:{
//定义一个命名空间,路径处添加相对路径
myApp:'ux'
}
});
Ext.onReady(function(){
Ext.create('ux.window',{
//可以根据个性修改值
title:'个性定制的title',
requires:['ux.window']
}).show();
});
})();
window.js
Ext.define('ux.window',{
extend:'Ext.window.Window',
width:200,
height:90,
title:'me is myExt.Window',
initComponent:function(){
this.callParent(arguments);
}
});
在createWindow.js中定义的命名空间是以当前文件位置而填写的相对路径(相对路径不能向上级回退[../])
在window.js中define的第一个参数实际就是相对于 = (命名空间路径 + 文件名)组成
例如以上目录改为如下
-->02(文件夹)
-->createWindow.js
-->createWindow.html
-->ux(文件夹)
-->window(文件夹)
-->window.js
则createWindow.js中paths改为{myApp:'ux/window'}
window.js中define中第一个参数改为'ux.window.window'
createWindow.js中Ext.create()第一个参数改为'ux.window.window'
requires改为'ux.window.window'
Extjs4 -- Ext.loader命名空间的配置的更多相关文章
- ExtJS笔记 Ext.Loader
Ext.Loader is the heart of the new dynamic dependency loading capability in Ext JS 4+. It is most co ...
- Ext.Loader
Ext.Loader是Ext JS4动态加载的核心,等价于Ext.require简写. Ext.Loader支持异步和同步加载的方法. 异步 优点: 1.跨域 2.不需要web服务器 3.调试方便(可 ...
- Ext4报错Uncaught Ext.Loader is not enabled
提示: Uncaught Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing requ ...
- sencha警告:[WARN][Anonymous] [Ext.Loader] Synchronously loading 'Ext.field.Text'
chrome开发者工具下提示: [WARN][Anonymous] [Ext.Loader] Synchronously loading 'Ext.field.Text'; consider addi ...
- Spring配置文件中未引入dubbo命名空间头部配置而引起的错误案例
问题描述: Spring配置文件中未引入dubbo命名空间的头部配置而引起项目启动时报出如下错误信息: org.springframework.beans.factory.xml.XmlBeanDef ...
- Webpack的详细配置,[Webpack中各种loader的安装配置]
在使用webpack的时候,你是不是被以下这种报错所困扰: 注意看 黄色框中标注的 You may need an appropriate loader to handle this file typ ...
- create react app的 css loader 进行局部配置
{ test: cssRegex, exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, sourceMap: isEnv ...
- Extjs-4.2.1(二)——使用Ext.define自定义类
鸣谢:http://www.cnblogs.com/youring2/archive/2013/08/22/3274135.html --------------------------------- ...
- EXTJS4自学手册——EXT基本方法、属性(mixins多继承、statics、require)
1.mixins 说明:类似于面向对象中的多继承 <script type="text/javascript"> Ext.onReady(function () {// ...
随机推荐
- easyui layout 布局title
<script> function aclick(){ $("a").click(function () { var name=this.innerHTML; $($( ...
- checkbox属性checked="checked"已有,但却不显示打勾的解决办法
2014-02-05 BIWEB开发技巧 9919 在做权限管理的时候,做了一个功能,就是当勾选栏目,把所有的权限全勾上.刚开始使用了如下代码: function check(id,check) { ...
- 数据库查询优化-SQL优化
1.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描,如:select id from t where num is null可以在num上设置默 ...
- 【转】Centos升级Python 2.7.12并安装pip、ipython
Centos系统一般默认就安装有Python2.6.6版本,不少软件需要2.7以上的,通过包管理工具安装不了最新的版本,通过源码编译可以方便安装指定版本,只需要把下面版本的数字换成你想要的版本号. 1 ...
- MySQL问题记录--Can't connect to MySQL server on localhost (10061)解决方法
本文mysql的安装环境为win7 64位,mysql版本为MySQL5.7 问题描述:在命令行输入 mysql -u root -p 登录mysql,返回"Can't connect to ...
- 为了防止采集,把文章中出现的URL链接随机大小写(PHP实现)
<?php $string = "http://www.kxblogs.com/n/20161115/74439155.html"; $string = explode('/ ...
- ionic 通过PouchDB + SQLite来实现app的本地存储(Local Storage)
首先声明,本教程参考国外网站(http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-your-ionic-app/) ...
- Eclipse 安装需要的 JDK 版本简要说明
Eclipse 4.6 (Neon) Eclipse 4.6 (Neon)is scheduled for release on June 22, 2016. Consider using the I ...
- sessionStorage & localStorage & cookie
sessionStorage & localStorage & cookie 概念 html5中的Web Storage包括了两种存储方式:sessionStorage和localSt ...
- 断言(assert)的用法
我一直以为assert仅仅是个报错函数,事实上,它居然是个宏,并且作用并非“报错”. 在经过对其进行一定了解之后,对其作用及用法有了一定的了解,assert()的用法像是一种“契约式编程”,在我的理解 ...