Extjs4.1MVC详细解释
app.js
- Ext.onReady(function(){
- Ext.QuickTips.init();
- Ext.Loader.setConfig({ //开启自己主动载入功能
- enabled:true
- });
- Ext.application({
- name:'AM', //自己定义命名空间。通常都定义为AM
- appFolder:'app', //配置Ext框架所在的文件文件夹
- launch:function(){ //在全部资源都加载成功后执行
- Ext.create('Ext.container.Viewport',{
- items:{
- width:1500,
- height:500,
- xtype:'mainlayout' //这里引用了自己定义的组件mainlayout(视图层的MainLayout的别称)
- }
- });
- },
- controllers:[ //载入全部的控制器
- 'UserController'
- ]
- });
- });
控制层:
UserController.js
- Ext.define('AM.controller.UserController',{
- extend:'Ext.app.Controller',//继承Ext.app.Controller类
- init:function(){
- this.control({ //控制事件处理
- 'userlist button[id=add]':{
- click:function(){
- //do something
- }
- }
- });
- },
- views:[
- 'UserList', //放在MainLayout之前载入
- 'DeptList',
- 'MainLayout'
- ],
- stores:[
- 'UserStore',
- 'DeptStore'
- ],
- models:[
- 'UserModel'
- ]
- });
Model层:
UserModel.js
- Ext.define('AM.model.UserModel',{
- extend:'Ext.data.Model', //用来绑定到grid表字段
- fields:[
- {name:'id',type:'string'},
- {name:'name',type:'auto'},
- {name:'password',type:'string'},
- {name:'birth',type:'auto'},
- {name:'email',type:'auto'},
- {name:'intro',type:'string'}
- ]
- });
Store层:
UserStore.js
- Ext.define('AM.store.UserStore',{
- extend:'Ext.data.Store',
- model:'AM.model.UserModel',
- proxy:{
- type:'ajax',
- url:'/ExtjsTest/test/readuser',
- reader:{
- type:'json',
- root:'userinfo'
- },
- writer:{
- type:'json'
- }
- },
- autoLoad:true
- });
DeptStore.js
- Ext.define('AM.store.DeptStore',{
- extend:'Ext.data.TreeStore',
- defautRootId:'root',
- proxy:{
- type:'ajax',
- url:'/ExtjsTest/test/showuser',
- reader:{
- type:'json'
- },
- writer:{
- type:'json'
- }
- },
- autoLoad:true
- });
视图层:
UserList.js
- Ext.define('AM.view.UserList',{
- extend:'Ext.grid.Panel', //GridPanel组件
- alias:'widget.userlist', //别名
- // title:'用户信息',
- width:500,
- height:500,
- store:'UserStore', //绑定UserStore数据集
- selModel:{
- selType:'checkboxmodel'
- },
- tbar:[{text:"加入",id:'add'},{text:'删除',id:'del'},{text:'保存',id:'save'}], //button事件在控制层写
- columns:[{header:'编号',dataIndex:'id',field:{xtype:'textfield',allowBlank:false}},
- {header:'姓名',dataIndex:'name',field:{xtype:'textfield',allowBlank:false}},
- {header:'密码',dataIndex:'password',field:{xtype:'textfield',allowBlank:false}},
- {header:'生日',dataIndex:'birth',field:{xtype:'datefield',allowBlank:false}},
- {header:'邮件',dataIndex:'email',field:{xtype:'textfield',allowBlank:false}},
- {header:'简单介绍',dataIndex:'intro',field:{xtype:'textfield',allowBlank:false}}],
- ]
- });
DeptList.js
- Ext.define('AM.view.DeptList',{
- extend:'Ext.tree.Panel', //TreePanel组件
- alias:'widget.deptlist',
- // title:'树',
- width:300,
- height:500,
- rootVisible:false,
- dockedItems:[{
- xtype:'toolbar',
- dock:'left',
- items:[
- {xtype:'button',text:'add',id:'add'},
- {xtype:'button',text:'delete',id:'del'},
- {xtype:'button',text:'copy',id:'copy'}
- ]
- },
- store:'DeptStore', //绑定DeptStore数据集
- }
- });
效果图:

版权声明:本文博客原创文章,博客,未经同意,不得转载。
Extjs4.1MVC详细解释的更多相关文章
- .htaccess语法之RewriteCond与RewriteRule指令格式详细解释
htaccess语法之RewriteCond与RewriteRule指令格式详细解释 (2012-11-09 18:09:08) 转载▼ 标签: htaccess it 分类: 网络 上文htacc ...
- cookie的详细解释
突然看到网页上中英文切换的效果,不明白怎么弄得查了查 查到了cookie 并且附有详细解释 就copy留作 以后温习 http://blog.csdn.net/xidor/article/detail ...
- tar命令的详细解释
tar命令的详细解释 标签: linuxfileoutputbashinputshell 2010-05-04 12:11 235881人阅读 评论(12) 收藏 举报 分类: linux/unix ...
- Linux学习笔记15——GDB 命令详细解释【转】
GDB 命令详细解释 Linux中包含有一个很有用的调试工具--gdb(GNU Debuger),它可以用来调试C和C++程序,功能不亚于Windows下的许多图形界面的调试工具. 和所有常用的调试工 ...
- C语言 - 结构体(struct)比特字段(:) 详细解释
结构体(struct)比特字段(:) 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/26722511 结构体(struc ...
- 姿势体系结构的详细解释 -- C
我基本上总结出以下4部分: 1.问题的足迹大小. 2.字节对齐问题. 3.特别保留位0. 4.这种结构被存储在存储器中的位置. #include <stdio.h> #include &l ...
- Java - 面向对象(object oriented)计划 详细解释
面向对象(object oriented)计划 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24058107 程序包括 ...
- 设计模式 - 迭代模式(iterator pattern) Java 迭代器(Iterator) 详细解释
迭代模式(iterator pattern) Java 迭代器(Iterator) 详细解释 本文地址: http://blog.csdn.net/caroline_wendy 參考迭代器模式(ite ...
- 设计模式 - 观察者模式(Observer Pattern) 详细解释
观察者模式(Observer Pattern) 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/26583157 版权全部 ...
随机推荐
- RH033读书笔记(2)-Lab 3 Getting Help with Commands
Lab 3 Getting Help with Commands Sequence 1: Using the Help Tools 1. man -f keyword whatis keyword l ...
- skyeye安装+arm-elf-gdb安装+模拟s3c44b0x+执行ucos4skyeye
[假设你要引用.请阅读所有,这里是我的为期两天的过程只是一个记录] skyeye安装:ubuntu12.0432 llvm2.8 skyeye1.3.3 http://blog.chinaunix.n ...
- YT新人之巅峰大决战03
题目链接 Problem Description Now give you two integers n m, you just tell me the m-th number after radix ...
- C#设计及其UML(反向工程)
OOP之C#设计及其UML(反向工程) 现在总结一下C#类关键字(virtual.abstract.override.new.sealed)的使用(以C#代码体现),并再次熟悉一下OOP思想,使用 ...
- windows下VC界面 DIY系列1----写给想要写界面的C++程序猿的话
非常早就想写关于C++ UI开发的一系列博文,博客专栏刚审核通过,就立即開始刷博文,不能辜负自己的一番热血,我并非写界面的高手,仅仅想通过写博文提高我自己的技术积累,也顺便帮助大家解决界面开发的瓶颈. ...
- Appium之java API
AppiumDriver getAppStrings() 默认系统语言相应的Strings.xml文件内的数据. driver.getAppStrings(String language) 查找某一个 ...
- Spring MVC框架搭建
Spring MVC篇一.搭建Spring MVC框架 本项目旨在搭建一个简单的Spring MVC框架,了解Spring MVC的基础配置等内容. 一.项目结构 本项目使用idea intellij ...
- 微信oauth获取用户的信息页面授权
參考链接(请在微信client中打开此链接体验) Scope为snsapi_base https://open.weixin.qq.com/connect/oauth2/authorize?appid ...
- 手把手教你如何加入到github的开源世界! (转)
我曾经一直想加入到开源项目中,但是因为没有人指导流程,网上看了很多,基本都是说了个大概,如果你也是一个初出茅庐的人,那么,我将以自己提交的一次开源代码为例,教会你步入开源的世界. 1,首先登陆到htt ...
- 怎么样linux下的目录名的目录,系统用来操作空间
在Windows操作系统可以容易地创建\举\空删除的目录名格目录, 在linux我们需要一些特殊的处理能力实现上述功能. (1)创建一个目录 mkdir my\ first 此命令创建一个目录&quo ...