extjs firsttimer在加载库时遇到问题

时间:2013-12-19 18:16:35

标签: extjs

我理解这是一个基于java的框架,但我想尝试在asp.net应用程序中实现一个小部件,因为它主要涉及javascript的东西。我将库添加到我的项目文件夹目录中,似乎jar文件未按预期加载。

Failed to load resource: the server responded with a status of 404 
      (Not Found) http://localhost:52856/extjs/ext-debug.js
Failed to load resource: the server responded with a status of 404 
      (Not Found) http://localhost:52856/extjs/examples/app/simple/app.js
Failed to load resource: the server responded with a status of 404 
     (Not Found) http://localhost:52856/extjs/examples/shared/include-ext.js
Failed to load resource: the server responded with a status of 404 
     (Not Found) http://localhost:52856/extjs/examples/shared/options-toolbar.js
Failed to load resource: the server responded with a status of 404 
     (Not Found) http://localhost:52856/portal.js

Extjs是否有CDM,我们可以从google.apis加载库。

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

 <script type="text/javascript" src="extjs/ext-debug.js"></script>
 <script type="text/javascript" src="extjs/examples/app/simple/app.js"></script>
 <script type="text/javascript" src="extjs/examples/shared/include-ext.js"></script>
 <script type="text/javascript" src="extjs/examples/shared/options-toolbar.js"></script>

 <link rel="stylesheet" type="text/css" href="extjs/examples/portal/portal.css" />

 <script type="text/javascript">
     Ext.Loader.setPath('Ext.app', 'classes');
</script>
<script type="text/javascript" src="portal.js"></script>
<script type="text/javascript">
    Ext.require([
        'Ext.layout.container.*',
        'Ext.resizer.Splitter',
        'Ext.fx.target.Element',
        'Ext.fx.target.Component',
        'Ext.window.Window',
        'Ext.app.Portlet',
        'Ext.app.PortalColumn',
        'Ext.app.PortalPanel',
        'Ext.app.Portlet',
        'Ext.app.PortalDropZone',
        'Ext.app.GridPortlet',
        'Ext.app.ChartPortlet'
    ]);

    Ext.onReady(function () {
        Ext.create('Ext.app.Portal');
    });
</script>

</head>


<body>

<span id="app-msg" style="display:none;"></span>

修改

我接受了下面的答案,但在尝试加载其他文件时发现自己有无穷无尽的错误。我认为ext-all.js基本上加载了所有引用,你必须在你的函数中定义这些,但我想我又迷失了

Failed to load resource: the server responded with a status of 404  
   (Not Found)  http://cdn.sencha.com/ext/gpl/4.2.1/ext-base.js
Uncaught TypeError: Object prototype may only be an Object or null 
    ext-all-debug.js:19552
Uncaught ReferenceError: Highcharts is not defined exporting.js:9
Uncaught TypeError: Object [object Object] has no method 'addCls' ext-all.js:21

1 个答案:

答案 0 :(得分:1)

Extjs有一个CDN。您可以访问:http://cdn.sencha.com/ext/gpl/4.2.1/ext-all.js

编辑: 从您的帖子看,您似乎正在尝试将整个示例导入到您的项目中。我开始变小了。以下是如何将窗口加载到页面中的示例:

<script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/4.2.1/ext-all.js">    </script>
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.com/ext/gpl/4.2.1/resources/css/ext-all.css" />
<script type="text/javascript"> 
    Ext.require([
        'Ext.window.Window'
    ]);

     Ext.onReady(function () {
         var window = Ext.create('Ext.window.Window', {
             title: "my first ext window",
             width: 250,
             height: 150             
         });
         window.show();
    });
</script>