extjs4.2之页面框架搭建完整步骤(二)
来源:互联网 发布:标签打印软件有哪些 编辑:程序博客网 时间:2024/04/28 10:26
在一里完成了框架的基本搭建,今天来实现功能
1、在model创建Customer.js
Ext.define('RCP.model.Customer', { extend: 'Ext.data.Model', fields: [ { name: 'cusId', type: 'string' }, { name: 'cusName', type: 'string' }, { name: 'passWord', type: 'string' }, { name :'mobile', type:'string' }, { name:'email', type:'string' } ]});
2、在view里创建customer文件夹,在customer文件夹里创建List.js
Ext.define('RCP.view.customer.List', { extend: 'Ext.grid.Panel', alias: 'widget.customerList', padding: 5, autoScroll: true, title: '客户信息', emptyText: '无客户信息', initComponent: function () { var me = this; var store = Ext.create('Ext.data.Store', { model: 'RCP.model.Customer', proxy: { type: 'ajax', url: 'customer/listCustomerAction.action', reader: { type: 'json', root: 'customer', //后台传到前台全局变量 successProperty: 'success' } }, autoLoad: true }); this.columns = [ { header: '用户名称', dataIndex: 'cusName', flex: 1 }, { header: '邮箱', dataIndex: 'email', flex: 1 }, { header:'电话', dataInde:'mobile', flex:1 } ]; this.store = store; var refreshAction = Ext.create('Ext.Action', { text: '刷新', handler: function () { store.reload(); } }); this.dockedItems = [ { dock: 'top', xtype: 'toolbar', items: [ refreshAction ] } ]; this.callParent(arguments); }});3、修改Navigation.js内容Ext.define('RCP.view.Navigation', { extend: 'Ext.tree.Panel', alias: 'widget.navigation', title: '功能导航', rootVisible: false, lines: false, useArrows: true, initComponent: function () { Ext.apply(this, { store: new Ext.data.TreeStore({ root: { expanded: true, children: [ { text: '员工信息管理', expanded: true, children: [ { id: 'customerList', text: '员工信息维护', leaf: true } ] }, { text: '系统管理', expanded: true, children: [ { id: 'usersList', text: '用户管理', leaf: true }, { id: 'programTreeList', text: '功能管理', leaf: true }, { id: 'roleList', text: '角色管理', leaf: true } ] } ] } }), viewConfig: { //可拖动 plugins: { ptype: 'treeviewdragdrop', containerScroll: true } } }); this.callParent(); }});4、在controller里的Test.js里修改内容Ext.define('RCP.controller.Test',{ extend:'Ext.app.Controller', requests:[ 'Ext.window.Window' ],//------------------添加model和view------------------------------------------------- models:[ 'Customer@RCP.model' ], views:[ 'List@RCP.view.customer' ],//--------------添加model和view------------------------------------------------------ refs: [ { ref: 'viewport', selector: 'viewport' }, { ref: 'navigation', selector: 'navigation' }, { ref: 'contentPanel', selector: 'contentPanel' } ] ,//----------------导航栏点击事件----------------------------------------- init: function () { this.control({ 'navigation': { selectionchange: 'onNavSelectionChange' } }); }, onNavSelectionChange: function (selModel, records) { alert("c"); var record = records[0]; var text = record.get('text'); var xtype = record.get('id'); var alias = 'widget.' + xtype; var contentPanel = this.getContentPanel(); var cmp; if (xtype) { contentPanel.removeAll(true); var className = Ext.ClassManager.getNameByAlias(alias); var viewClass = Ext.ClassManager.get(className); cmp = new viewClass(); contentPanel.add(cmp); cmp.show(); contentPanel.setTitle(text); document.title = document.title.split(' - ')[0] + ' - ' + text; location.hash = xtype; } }});
0 0
- extjs4.2之页面框架搭建完整步骤(二)
- extjs4.2之页面框架搭建完整步骤(一)
- vue框架搭建的详细步骤之项目结构(二)
- Extjs4框架的搭建
- Extjs4开发笔记(二)——框架的搭建
- Extjs4开发笔记(二)——框架的搭建
- nfs搭建完整步骤
- vue框架搭建的详细步骤之脚手架(一)
- 框架搭建-SSI搭建步骤详解版本二
- Python3之Django框架搭建详细步骤
- APICloud成长记录 二 页面框架搭建
- 跟我学框架之struts框架搭建(二)
- 从框架到完整项目搭建,实战项目《约个球》(2)-框架搭建之使用CrashHandler来获取应用的Crash信息
- 搭建x5页面框架的6个步骤
- HTTPS + Tomcat搭建完整步骤
- 自己动手搭建ava通用开发框架之二—后台页面技术选型
- SSH框架整合完整步骤
- Extjs4.2 MVC框架
- javap简介
- CF 求最短路径的具体构成
- sicily1050-Numbers & Letters
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 黑马程序员数组C和OC遍历异同浅析
- extjs4.2之页面框架搭建完整步骤(二)
- Android录音实现——使用AtudioRecord
- android布局--Android fill_parent、wrap_content和match_parent的区别
- hdoj1255_覆盖的面积(线段树)
- Telnet协议详解
- 网络相机上位机软件驱动分析
- 贵有恒,何必三更起五更眠;最无益,只怕一日曝十日寒
- 一个非常实用的例子
- 零基础也能用Linux ---深度Linux使用小记