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>

代码下载:

http://pan.baidu.com/share/link?shareid=61215000&uk=3993055813#dir/path=%2F%E5%8D%9A%E5%AE%A2%E4%BB%A3%E7%A0%81

ExtJS 4 MVC 创建 Viewport的更多相关文章

  1. Spring mvc创建的web项目,如何获知其web的项目名称,访问具体的链接地址?

    Spring mvc创建的web项目,如何获知其web的项目名称,访问具体的链接地址? 访问URL:  http://localhost:8090/firstapp/login 在eclipse集成的 ...

  2. Extjs 6 MVC开发模式(一)

    1.Extjs就绪函数 1)导入Extjs的CSS <link rel="stylesheet" type="text/css" href="r ...

  3. MVC创建XML,并实现增删改

    原文:MVC创建XML,并实现增删改 如果创建如下的XML: <?xml version="1.0" encoding="utf-8" standalon ...

  4. ASP.NET MVC创建的网站

    ASP.NET MVC创建的网站   最近在写一个网站,昨天刚写完,由于要和朋友一起测试,但是他电脑上没有环境,所以希望我在自己电脑上部署一下,让他直接通过浏览器来访问来测试,所以从昨晚到今天上午,通 ...

  5. 【翻译】在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 ...

  6. 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 创 ...

  7. 使用 ASP.NET Core MVC 创建 Web API(五)

    使用 ASP.NET Core MVC 创建 Web API 使用 ASP.NET Core MVC 创建 Web API(一) 使用 ASP.NET Core MVC 创建 Web API(二) 使 ...

  8. 使用 ASP.NET Core MVC 创建 Web API(二)

    使用 ASP.NET Core MVC 创建 Web API 使用 ASP.NET Core MVC 创建 Web API(一) 六.添加数据库上下文 数据库上下文是使用Entity Framewor ...

  9. 使用 ASP.NET Core MVC 创建 Web API(三)

    使用 ASP.NET Core MVC 创建 Web API 使用 ASP.NET Core MVC 创建 Web API(一) 使用 ASP.NET Core MVC 创建 Web API(二) 十 ...

随机推荐

  1. PDO的基本操作

    PDO的基本操作 连接到mysql: try { $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass); foreach($ ...

  2. poj3648,2-sat求解

    关键是题意的理解,英语,有时候明明每个字都认识,但是还是理解错误!哎!!悲剧啊!题意啊! 这是关键!开始误理解为n对新娘郞,非也!是只有一对,其他是夫妇,理解后就好做了,建立图 是关键,怎么转化关系, ...

  3. maven 将项目打成jar包

    添加此plugin到项目的pom.xml <project xmlns=</modelVersion>     <groupId>fuck</groupId> ...

  4. 用"再生龙"Clonezilla 来克隆Linux系统

      上周公司买了5套高配置PC机来做测试用.上面要装好CentOS 加上一堆工具,有web的,数据库的,还有一些自己开发的工具.有些朋友肯定想,直接用kickstart不就行了,确实.kickstar ...

  5. Deepin-安装laravel

    首先获取到composer.phar wget https://getcomposer.org/download/1.6.3/composer.phar 下载以后移动到目标区域 sudo mv com ...

  6. vue 获取当前时间 格式YYYY-MM-DD

    函数封装: /** * 获取当前时间 * 格式YYYY-MM-DD */ Vue.prototype.getNowFormatDate = function() { var date = new Da ...

  7. httpclient发送get请求

    /** * 获取httpclient的请求url地址 */ public static String getUrl(){ String url = "http://"+map.ge ...

  8. Intel为Google的物联网平台Brillo推出开发板Edison

    Brillo* is a solution from Google* for building connected devices. Incorporating aspects of the Andr ...

  9. C语言将10进制转为2进制

    第一种方法: #include<stdio.h> void dectobin(int n); int main() { int x=0; scanf("%d",& ...

  10. MySql InnoDb还原工具

    通过任意文件下载找到了mysql的备份,表类型是独享式innodb,由一个frm文件和一个ibd文件组成. 本以为直接复制到本地的mysql数据目录中即可恢复数据,但在查询时却发现并不如所愿: mys ...