Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function Extjs ReferenceError(插入文件中的函数未定义)_Function_Extjs_Referenceerror - Fatal编程技术网

Function Extjs ReferenceError(插入文件中的函数未定义)

Function Extjs ReferenceError(插入文件中的函数未定义),function,extjs,referenceerror,Function,Extjs,Referenceerror,我将一些实用程序文件插入主应用程序。 但在函数Flang()上,没有引用:控制台中的web嗅探器问题: 引用错误:未定义法兰 index.html: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> ... <script type="text/javascript" src="application.js" ></sc

我将一些实用程序文件插入主应用程序。 但在函数Flang()上,没有引用:控制台中的web嗅探器问题: 引用错误:未定义法兰

index.html:

<html> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
...
<script type="text/javascript" src="application.js" ></script>

<script type="text/javascript" src="js/menu.js" ></script>  
<script type="text/javascript" src="js/lang.js" ></script> 

<script type="text/javascript" src="js/directories/assortment.js" ></script>

<title id="page-title">Main Application v.2.0</title>
    ...
在network inspector中,我看到加载了lang.js文件,但仍然没有定义此函数: 在application.js(本代码段的最后一行):

application.js:

...
function FLang(str){ 

 if (ComboBoxLang.getValue()=='en')
   return str;
 else if (ComboBoxLang.getValue()=='ru')
   return FappLangRu(str);
 else  
   return str;  
 };
 Ext.Loader.setPath('Ext.ux', '../app/extjs/examples/ux');
 Ext.require([
   'Ext.ux.grid.FiltersFeature',
    'Ext.ux.grid.*', 
]);



Ext.ns("appMain");

...


appMain.NorthRegion = Ext.create('Ext.panel.Panel', {       
region: 'north',
xtype: 'panel',
id: 'NorthRegion',              
border:true,
title: FLang('Subsystems'),  
 appMain.WestRegion= Ext.create('Ext.panel.Panel', {        
    region: 'west',
    xtype: 'panel',
    collapsible: true,
    floatable: true,
    width: 100,
    split: true,                
    border:true,
    title: FLang('Subsystem control'),

 }); // end of $WestRegion
 appMain.CenterRegion = Ext.create('Ext.tab.Panel', {       
region: 'center',
xtype: 'tabpanel',      
border: true,
title: FLang('Main window'),
autoScroll:true,
 }); 
它是否与名称空间有关,因为在此之前没有名称空间就没有引用问题

编辑 定义完所有区域及其内容后,我们按以下方式启动应用程序:

Ext.onReady(function() {

var MainView = Ext.create('Ext.Viewport', {
    layout:'border',
    border:true,
    items:[ 
        appMain.NorthRegion,
        appMain.WestRegion,
        appMain.CenterRegion   
    ], // end of viewport items      
}); 



}); // end of Ext.onReady() function

尝试更改index.html中包含
lang.js
application.js
的顺序。然而,即使它确实有效,仍然存在一个问题。在文档准备就绪之前,您不能创建组件,因此,所有
Ext.create
调用必须封装在
onReady


请参阅以了解更多信息

与名称空间无关,只要包含该文件,它就可用。围绕应用程序创建的代码很重要。什么时候调用
FLang
了?@Evan Trimboli,我添加了编辑以显示我们如何启动应用程序。调用
Flang
是在NorthRegion配置中进行的-标题:Flang('subsystem'),(参见application.js中)仍然没有足够的信息。在上下文中,何时调用
FLang
onReady
部分不相关,因为此时已创建面板。@Evan Trimboli,我已将代码添加到application.js,但我不知道何时调用
Flang
。我怎么知道?什么上下文?在
application.js
中,您没有显示全部内容。创建面板时,它是否被包装在任何东西中?如果不是,则是简单的加载顺序。您的
application.js
包含在内,并在
lang.js
之前运行。