Model view controller Ext.Load找不到所需文件时出现问题
我正在尝试学习ExtJS4使用的新MVC体系结构,我遇到了一些严重的问题。以下是我加载页面(Chrome JS控制台)时得到的结果: 下面是我的代码分解: index.phpModel view controller Ext.Load找不到所需文件时出现问题,model-view-controller,extjs4,Model View Controller,Extjs4,我正在尝试学习ExtJS4使用的新MVC体系结构,我遇到了一些严重的问题。以下是我加载页面(Chrome JS控制台)时得到的结果: 下面是我的代码分解: index.php <html> <head> <title></title> <style> @import url('libraries/extjs/resources/css/ext-all.css');
<html>
<head>
<title></title>
<style>
@import url('libraries/extjs/resources/css/ext-all.css');
</style>
<script src = "libraries/extjs/bootstrap.js"></script>
<!--
<script src = "public/app/controller/Users.js"></script>
-->
<script src = "public/app/app.js"></script>
<script>
</script>
</head>
<body>
</body>
</html>
用户模型
Ext.define('Exercise.model.User', {
extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'created_at',
type: 'date',
dateFormat: 'Y-m-d H:i:s'
}, {
name: 'member_id',
type: 'int'
}, {
name: 'first_name',
type: 'string'
}, {
name: 'last_name',
type: 'string'
}, {
name: 'password',
type: 'string'
}, {
name: 'dob',
type: 'date',
dateFormat: 'Y-m-d'
}, {
name: 'email_address',
type: 'string'
}, {
name: 'is_active',
type: 'int'
}],
proxy: {
type: 'ajax',
format: 'json',
url: '../../_dev/json_fixtures/users.json',
reader: {
type: 'json',
root: 'users'
},
root: 'users'
}
});
用户视图
Exercise.views.user.list = Ext.extend(Ext.grid.Panel, {
store: Exercise.stores.users,
renderTo: Ext.getBody(),
columns:[{
header: 'Member ID',
dataIndex: 'member_id'
}, {
header: 'First Name',
dataIndex: 'first_name'
}, {
header: 'Last Name',
dataIndex: 'last_name'
}],
initComponent: function() {
Exercise.stores.users.load();
Exercise.views.UsersList.superclass.initComponent.apply(this, arguments);
}
});
app.js文件
Ext.application({
name: 'Exercise',
autoCreateViewport: true,
appFolder: 'app',
controllers: [
'Users'
],
launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Users',
html : 'List of users will go here'
}
]
});
}
});
旁注:我尝试了发现无效的解决方案,并尝试将我的应用程序appFolder
属性设置为。/app
和app
谢谢你在这方面的帮助 你看过我的问题了吗。。(应与最终版本一起使用) 这是因为默认情况下,
Ext.Loader
被禁用
Ext.Loader.setConfig({enabled:true});
你读过我的问题了吗。。(应与最终版本一起使用) 这是因为默认情况下,
Ext.Loader
被禁用
Ext.Loader.setConfig({enabled:true});
我也犯了那个错误。Ext 4.0 MVC系统不使用bootstrap.js,而是使用Ext-debug.js。当您准备投入生产时,您将在编译阶段替换ext-debug.js 您的HTML文件应如下所示:
<html>
<head>
<title></title>
<style>
@import url('libraries/extjs/resources/css/ext-all.css');
</style>
<!-- The MVC system needs ext-debug.js, not bootstrap.js -->
<script src = "libraries/extjs/ext-debug.js"></script>
<script src = "public/app/app.js"></script>
<script>
</script>
</head>
<body>
</body>
</html>
@导入url('libraries/extjs/resources/css/ext all.css');
我也犯了那个错误。Ext 4.0 MVC系统不使用bootstrap.js,而是使用Ext-debug.js。当您准备投入生产时,您将在编译阶段替换ext-debug.js
您的HTML文件应如下所示:
<html>
<head>
<title></title>
<style>
@import url('libraries/extjs/resources/css/ext-all.css');
</style>
<!-- The MVC system needs ext-debug.js, not bootstrap.js -->
<script src = "libraries/extjs/ext-debug.js"></script>
<script src = "public/app/app.js"></script>
<script>
</script>
</head>
<body>
</body>
</html>
@导入url('libraries/extjs/resources/css/ext all.css');