EXT JS可以't从其他.js中获取Define
EXT JS can't get the Define from other .js
vehicle.js
var BtnEdit = Ext.getCmp('BtnEdit');
BtnEdit.on('click', function(){
var grid = Ext.getCmp('mygridpanel')
if (grid.getSelectionModel().hasSelection()) {
var row = grid.getSelectionModel().getSelection()[0];
console.log(row.get('Plat_No'));
};
var win = Ext.create('MyApp.view.Edit2');
win.show();
});
design.js
//==========================Edit Vehicle================================
Ext.define('MyApp.view.Edit2', {
extend: 'Ext.window.Window',
height: 218,
id: 'ChangePasswordWin',
width: 405,
title: 'Edit',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'container',
height: 193,
width: 515,
layout: {
align: 'center',
type: 'hbox'
},
items: [
{
xtype: 'container',
flex: 1,
margins: '',
height: 145,
padding: '10 10 10 10',
width: 393,
layout: {
type: 'vbox'
},
items: [
{
xtype: 'form',
flex: 1,
margins: '10 10 10 10',
height: 152,
width: 354,
bodyPadding: 10,
header: false,
title: 'My Form',
items: [
{
xtype: 'textfield',
disabled: true,
padding: '0 0 10 0',
width: 320,
fieldLabel: 'Vehicle ID',
labelWidth: 150
},
{
xtype: 'textfield',
padding: '0 0 10 0',
width: 320,
fieldLabel: 'Plat Number',
labelWidth: 150
}
]
}
]
}
]
}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
cls: '',
width: 59,
icon: '',
iconCls: 'save',
text: 'Save'
}
]
}
]
});
me.callParent(arguments);
}
});
index.html
<script type="text/javascript" src="vehicle.js"></script>
<script type="text/javascript" src="../resources/js/design.js"></script>
这是firebug日志
GET http://localhost/BusTicket/vehicle/MyApp/view/Edit2.js?_dc=1386481666308
404 Object Not Found
0ms
ext-all.js (line 27)
TypeError: c is not a constructor
...f(p==k){if(a+E+l.width>(O>=0?u.x+u.width-b:b-u.x)){p=M}}else{if(a+E>l.width){p=k...
我怎么会犯这个错误?
我建议您:
1.-使用与类相同的名称命名文件。
2.-然后在你的app.js(或者你称它为什么)中,将你的视图文件添加到相应的数组声明中。
Ext.application({
...
models: ['Station', 'Song'],
stores: ['Stations', 'RecentSongs', 'SearchResults'],
views: ['Edit2']
...
});
或者你也可以要求它:
requires: [
'MyApp.view.Edit2',
'Panda.view.NewStation',
'Panda.view.SongControls',
'Panda.view.StationsList',
'Panda.view.RecentlyPlayedScroller',
'Panda.view.SongInfo'
],
http://docs.sencha.com/extjs/4.2.1/#/指南/mvc_pt2
谨致问候。
相关文章:
- 如何在.js函数中检索来自其他模板的表单的目标值
- 为其他JS生成定义“;编译器”;来自TypeScript定义文件
- 如何将JS文件从其他文件夹链接到页面
- 如何在Angular js中集成其他页面中的样式
- 是否可以使用Chart.js缩短雷达图上的外部标签,而不影响其他标签
- 基本D3.js:如何将具有其他属性的数据绑定到元素
- 节点:'最佳实践'使用其他js文件的js文件
- 地理定位在Jsfidle中工作,但不在任何其他JS编辑器中
- 如何从其他方法访问Angular.js$scope
- 使用react.js渲染其他组件内部的组件
- 以编程方式将fabric-js-canvas的图像替换为hq图像,并重新计算其他对象的坐标和大小
- 如何忽略node.js中其他文件或组件所需的文件
- node.js express处理其他.get尝试
- Ajax 请求正在取消页面上的其他 JS 事件
- 如何使用其他 JavaScript 文件中的新类访问我的 createjs 导出的 js 文件
- 转到其他 URL 后,如何保持排序的骨干.js集合
- 节点.js“已调用回调”.但是没有任何其他回调
- 控制立方体或其他几何体的每个面,分为三.js
- Backbone.js-其他提供Collections的框架
- .js其他格式