Extjs之Gridpanel
2014-11-12 20:17
169 查看
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Extjs5 GridPanel</title> <link rel="stylesheet" type="text/css" href="extjs/packages/ext-theme-classic/build/resources/ext-theme-classic-all-debug.css"/> <link rel="stylesheet" type="text/css" href="extjs/packages/icon.css"/> <script src="extjs/ext-all-debug.js" type="text/javascript" charset="utf-8"></script> <script src="extjs/packages/ext-locale/build/ext-locale-zh_CN-debug.js" type="text/javascript"></script> <script type="text/javascript"> Ext.onReady(function(){ // 定义数据模型 Ext.define('User', { extend: 'Ext.data.Model', fields: [ 'name', 'email', 'age', 'phone' ] }); // 创建数据仓库 var store = Ext.create('Ext.data.Store', { model: 'User', pageSize: 5, data: { items: [{ name: 'Lisa', email: 'lisa@simpsons.com', age:23, phone: '555-111-1224' }, { name: 'Bart', email: 'bart@simpsons.com', age:23, phone: '555-222-1234' }, { name: 'Homer', email: 'homer@simpsons.com', age:23, phone: '555-222-1244' }, { name: 'Marge', email: 'marge@simpsons.com', age:23, phone: '555-222-1254' }, { name: 'Marge', email: 'marge@simpsons.com', age:23, phone: '555-222-1254' }] }, proxy: { type: 'memory', reader: { type: 'json', rootProperty: 'items' } } }); // The data store containing the list of states var states = Ext.create('Ext.data.Store', { fields: ['abbr', 'name'], data : [ {"abbr":"AL", "name":"姓名"}, {"abbr":"AK", "name":"邮箱"}, {"abbr":"AZ", "name":"手机"} //... ] }); // Create the combo box, attached to the states data store var combo = Ext.create('Ext.form.ComboBox', { store: states, width:60, queryMode: 'local', displayField: 'name', valueField: 'abbr', allowBlank:false, value:'AL' }); // 创建数据表格 var grid = Ext.create('Ext.grid.Panel', { // xtype: 'gridpanel', // 指定创建gridpanel title: '管理员列表', region:'center', iconCls:'icon-Group', selType: "checkboxmodel", // 显示复选框 selModel: { injectCheckbox: 1, mode: "SIMPLE", //"SINGLE"/"SIMPLE"/"MULTI" checkOnly: true //只能通过checkbox选择 }, collapsible:true, columnLines:true, columns: [{ // 显示行号 xtype: "rownumberer", text: '' },{ text: '姓名', dataIndex: 'name' }, { text: '邮箱', dataIndex: 'email', flex: 1 },{ text: '年龄', dataIndex: 'age' }, { text: '手机', dataIndex: 'phone' }], store: store, // 创建工具栏 tbar:[{ xtype:'button', iconCls:'icon-Add', text:'添加', listeners:{ click:function(){ alert('Add'); } } }, { xtype:'button', iconCls:'icon-Bulletedit', text:'修改' }, '-' ,{ xtype:'button', iconCls:'icon-Delete', text:'删除' }, { xtype:'button', iconCls:'icon-Delete', text:'批量删除' }, '-', { xtype:'button', iconCls:'icon-Pageexcel', text:'导出' }, '->', combo, { xtype:'textfield' }, { xtype:'button', plain: true, text:'检索', iconCls:'icon-Bulletmagnify' }, { xtype:'button', plain: true, text:'高级检索', iconCls:'icon-Bulletmagnify' }], bbar: { xtype: "pagingtoolbar", store: store, displayInfo: true } }); // 创建应用 Ext.create('Ext.panel.Panel', { plugins: 'viewport', // 自适应浏览器窗口 layout: 'fit', border: false, items: { xtype: 'panel', layout: 'border', border: false, items: [grid] } }); }); </script> </head> <body> </body> </html>
相关文章推荐
- Extjs 的GridPanel剔除隐藏列在menuDisabled 显示
- ExtJs GridPanel动态生成表单
- ExtJS 普通表格:Ext.grid.GridPanel属性祥解
- Extjs的GridPanel的RowExpander的扩展
- 『转』让ExtJS里的GridPanel的列能够自动决定宽度
- [ExtJS5学习笔记]第三十节 sencha extjs 5表格gridpanel分组汇总
- extjs4学习资料(gridpanel布局问题)
- ExtJS 4学习之GridPanel
- 无废话ExtJs 入门教程十七[列表:GridPanel]
- ExtJs 设置GridPanel表格文本垂直居中
- Extjs gridPanel对选中行的操作
- Extjs GridPanel 中放入 Combox显示问题
- 在写extjs中一个panel里放了3个grid,但就是不显示页面,后台给出数据,前台也有加载数据
- ExtJs 之GridPanel实例
- extjs之GridPanel表格
- ExtJs GridPanel 生成列
- Extjs grid panel 滚动条失效的解决方法
- ExtJS:GridPanel之renderer:function()和itemdblclick : function()方法参数详解
- (Extjs)对于GridPanel的各种操作