ExtJS 4 MVC 创建 Viewport
http://ext4all.com/post/extjs-4-mvc-with-viewport
效果图:

结构图:

没有用到Model层,直接在view里面写上 默认的 json的数据
中间Panel的内容
app/view/Panelcenter.js
//Panel内容
Ext.define('wjw.view.Panelcenter', {
extend: 'Ext.grid.Panel',
alias: 'widget.pcenter', //别名
title: 'All Users',
initComponent: function () {
this.store = {
fields: ['name', 'email', 'phone'],
data: [
{ 'name': 'wjw1', 'email': 'wjw1@163.com', 'phone': '1867883XXXX' },
{ 'name': 'wjw2', 'email': 'wjw2@163.com', 'phone': '1867883XXXX' },
{ 'name': 'wjw2', 'email': 'wjw3@163.com', 'phone': '1867883XXXX' },
{ 'name': 'wjw3', 'email': 'wjw4@163.com', 'phone': '1867883XXXX' },
{ 'name': 'wjw4', 'email': 'wjw5@163.com', 'phone': '1867883XXXX' }
]
};
this.columns = [
{ header: 'Name', dataIndex: 'name' },
{ header: 'Email', dataIndex: 'email' },
{ header: 'Phone', dataIndex: 'phone' }
];
this.callParent(arguments);//调用所有父类的方法
}
});
app/view/Emailpanel.js
Ext.define('wjw.view.Emailpanel', {
extend:'Ext.panel.Panel',
alias:'widget.empanel'
});
app/view/Emailpanel.js
Ext.define('wjw.view.Emailpanel', {
extend:'Ext.panel.Panel',
alias:'widget.empanel'
});
app/view/Viewport.js
Ext.define('wjw.view.Viewport', {
extend: 'Ext.container.Viewport',
layout: 'border',
requires: [
'wjw.view.Panelcenter',
'wjw.view.Emailpanel',
'wjw.view.Phonepanel'
],
//Error:is was initComponents
initComponent: function () {
Ext.apply(this, {
items: [{
xtype: 'pcenter',
title: 'center中间内容',
region: 'center',
margins: '5 5 5 5'
}, {
xtype: 'empanel', //email panel的别名
title: 'south底部',
region: 'south',
height: 150,
margins: '0 5 5 5' //上右下左
}, {
xtype: 'phPanel',
title: 'east右侧',
region: 'east',
width: 150,
margins: '5 5 5 0'
}]
});
//Error: do not forget this line in each initComponent method
this.callParent(arguments);
}
});
app/controller/controller.js
Ext.define('wjw.controller.Books', {
extend:'Ext.app.Controller',
views: [
'Panelcenter',
'Emailpanel',
'Phonepanel',
]
});
app/app.js
Ext.application({
name:'wjw',
appFolder:'app',
controllers: [
'Books'
],
autoCreateViewport:true //自动创建 Viewport
});
看看API内 对于autoCreateViewport的解释:自动加载并实例化 app的 app.view.Viewport. 也就是自动加载 app/view/Viewport.js

index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../../ext-4.2/bootstrap.js" type="text/javascript"></script>
<link href="../../ext-4.2/resources/css/ext-all-gray.css" rel="stylesheet" type="text/css" />
<script src="app.js" type="text/javascript"></script>
</head>
<body> </body>
</html>
代码下载:
ExtJS 4 MVC 创建 Viewport的更多相关文章
- Spring mvc创建的web项目,如何获知其web的项目名称,访问具体的链接地址?
Spring mvc创建的web项目,如何获知其web的项目名称,访问具体的链接地址? 访问URL: http://localhost:8090/firstapp/login 在eclipse集成的 ...
- Extjs 6 MVC开发模式(一)
1.Extjs就绪函数 1)导入Extjs的CSS <link rel="stylesheet" type="text/css" href="r ...
- MVC创建XML,并实现增删改
原文:MVC创建XML,并实现增删改 如果创建如下的XML: <?xml version="1.0" encoding="utf-8" standalon ...
- ASP.NET MVC创建的网站
ASP.NET MVC创建的网站 最近在写一个网站,昨天刚写完,由于要和朋友一起测试,但是他电脑上没有环境,所以希望我在自己电脑上部署一下,让他直接通过浏览器来访问来测试,所以从昨晚到今天上午,通 ...
- 【翻译】在Visual Studio中使用Asp.Net Core MVC创建你的第一个Web API应用(一)
HTTP is not just for serving up web pages. It's also a powerful platform for building APIs that expo ...
- 002.Create a web API with ASP.NET Core MVC and Visual Studio for Windows -- 【在windows上用vs与asp.net core mvc 创建一个 web api 程序】
Create a web API with ASP.NET Core MVC and Visual Studio for Windows 在windows上用vs与asp.net core mvc 创 ...
- 使用 ASP.NET Core MVC 创建 Web API(五)
使用 ASP.NET Core MVC 创建 Web API 使用 ASP.NET Core MVC 创建 Web API(一) 使用 ASP.NET Core MVC 创建 Web API(二) 使 ...
- 使用 ASP.NET Core MVC 创建 Web API(二)
使用 ASP.NET Core MVC 创建 Web API 使用 ASP.NET Core MVC 创建 Web API(一) 六.添加数据库上下文 数据库上下文是使用Entity Framewor ...
- 使用 ASP.NET Core MVC 创建 Web API(三)
使用 ASP.NET Core MVC 创建 Web API 使用 ASP.NET Core MVC 创建 Web API(一) 使用 ASP.NET Core MVC 创建 Web API(二) 十 ...
随机推荐
- 【HDOJ6322】Euler Function(数论)
题意: 思路: #include <stdio.h> #include <vector> #include <algorithm> #include <str ...
- 高精度模板(From JCVB)
#include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #i ...
- 【ZJOI2017 Round1练习】D2T1 river(二分图)
题意: 思路:这道题并没有官方题解 没有羊驼在所有三元组中出现就是NO 现在考虑不少于1只的情况 删去其中一只,我们得到了两组点和一些边 我们只要判断这是否为一张二分图,使用暴力染色的方法就有60分了 ...
- 【POJ3294】Life Forms(后缀数组,二分)
题意: n<=100 len[i]<=1000 思路:这是一道论文题 ..]of longint; ch:..]of ansistring; n,n1,l,r,mid,last,i,j,m ...
- Treasure Hunt--poj1066(最短路加判断线段的关系)
http://poj.org/problem?id=1066 题目大意:有n条线段 他们都在这个房间里 最后有一个点代表起始位置 现在想通过墙出去 他只能爆破每个房间的中点的门 问最少的门通 ...
- [HDU4607]Park Visit(树上最长链)
HDU#4607. Park Visit 题目描述 Claire and her little friend, ykwd, are travelling in Shevchenko's Park! T ...
- POJ 3254 【状态压缩DP】
题意: 给一块n*m的田地,1代表肥沃,0代表贫瘠. 现在要求在肥沃的土地上种草,要求任何两个草都不能相邻. 问一共有多少种种草的方法. 种0棵草也是其中的一种方法. n和m都不大于12. 思路: 状 ...
- javascript创建对象总结(javascript高级程序设计)
1.工厂模式 这样的模式抽象创建详细对象的过程.用函数封装特定的接口来创建类. function createStudent(name) { var o = new Object(); o.name ...
- 【转】ubuntu 下安装mongodb php 拓展的方法
按照上面的方法安装成功之后,写一个 mongodb 的php测试脚本,用来测试是否可以 正确连接上mongodb ,并查询结果. 参考:http://php.net/manual/en/class.m ...
- XMLHttpRequest对象解读
<!DOCTYPE html> <html> <body> <script> function reqListener () { console.log ...