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(二) 十 ...
随机推荐
- [NOIP2003] 提高组 洛谷P1040 加分二叉树
题目描述 设一个n个节点的二叉树tree的中序遍历为(1,2,3,…,n),其中数字1,2,3,…,n为节点编号.每个节点都有一个分数(均为正整数),记第i个节点的分数为di,tree及它的每个子树都 ...
- LightOJ1094 - Farthest Nodes in a Tree(树的直径)
http://lightoj.com/volume_showproblem.php?problem=1094 Given a tree (a connected graph with no cycle ...
- Hibernate学习笔记(三)
我是从b站视频上学习的hibernate框架,其中有很多和当前版本不符合之处,我在笔记中进行了修改以下是b站视频地址:https://www.bilibili.com/video/av14626440 ...
- JavaOne Online Hands-on Labs
http://www.oracle.com/technetwork/java/index-156938.html
- topcoder srm 552
div1 250pt: 题意:用RGB三种颜色的球摆N层的三角形,要求相邻的不同色,给出RGB的数量,问最多能摆几个 解法:三种颜色的数量要么是全一样,要么是两个一样,另外一个比他们多一个,于是可以分 ...
- Fortinet网络接入及安全方案配置步骤
http://sec.chinabyte.com/200/12553700.shtml 1.概述: Fortinet无线接入及方案由以下两类设备组成: AC(Wifi接入控制器)及安全网关:Forti ...
- [Javascript] Link to Other Objects through the JavaScript Prototype Chain
Objects have the ability to use data and methods that other objects contain, as long as it lives on ...
- Jenkins系列之-—03 修改Jenkins用户的密码
一.Jenkins修改用户密码 Jenkins用户的数据存放在JENKINS_HOME/users目录. 1. 打开忘记密码的用户文件夹,里面就一个文件config.xml.打开并找到<pass ...
- I2S简单学习
以下只是个人看法,有不妥之处,请批评指出. 参考资料:http://blog.csdn.net/ce123_zhouwei/article/details/6919954: 一.I2S接口简述 I²S ...
- android抓log
1.Logcat(能截取除了Kernel以外的所有Log信息),连接USB到电脑上,执行如下命令:User版本也可以使用adb logcat –v time >c:\ logcat.txtadb ...