javascript ExtJS 4 中的“Ext 未定义”问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11317047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 12:44:51  来源:igfitidea点击:

"Ext is not defined" issue in ExtJS 4

javascriptextjsfirebug

提问by sozhen

I came across a "Ext is not defined" issue in ExtJS 4. I am actually testing the example hereto starting learning ExtJS 4.

我在 ExtJS 4 中遇到了“Ext is not defined”问题。我实际上是在测试这里的示例以开始学习 ExtJS 4。

I have my example script file included:

我有我的示例脚本文件:

<script type="text/javascript" src="orderRead.js"></script>
<script type="text/javascript" src="order.js"></script>

as well as these ExtJS script files:

以及这些 ExtJS 脚本文件:

<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="extjs/ext-all-debug.js"></script>

but the problem is still there. Attached is the error message from Firebug: enter image description here

但问题仍然存在。附上来自 Firebug 的错误消息: 在此处输入图片说明

采纳答案by Guffa

Put the script tags for the Ext library before the script tags for your example files, so that they are loaded when your code runs.

将 Ext 库的脚本标签放在示例文件的脚本标签之前,以便在代码运行时加载它们。

回答by Pradip Kharbuja

You should include the ext-base.jsand ext-all.jsfiles in following order.

您应该按以下顺序包含ext-base.jsext-all.js文件。

<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>