星空网 > 软件开发 > Java

Sencha ExtJS 6 Widget Grid 入门

  最近由于业务需要,研究了一下Sencha ExtJS 6 ,虽然UI和性能上据相关资料说都有提升,但是用起来确实不太顺手,而且用Sencha cmd工具进行测试和发布,很多内部细节都是隐藏的,出了问题不好跟踪。更奇葩的是明明在sencha app watch上运行很好,但是sencha app build后会出现异常。即使是这样,但Sencha ExtJS 6 在UI控件和编程模式上确实比较强大。下面介绍一个 Widget Grid 用法,可以在表格grid中进行列样式渲染,是一个比较强大的功能:

1 拷贝admin-dashboard创建项目

2 配置app.json,主要用于中文提示和采用font-awesome字体库等

 1   /** 2    * The Sencha Framework for this application. 3   */ 4   "framework": "ext", 5   "locale": "zh_CN",//中文 6   /** 7    * The list of required packages (with optional versions; default is "latest"). 8    * https://docs.sencha.com/extjs/6.0/core_concepts/localization.html 9   */10   "requires": [11     "charts",12     "font-awesome",//字体13     "ux",14     "ext-locale"15   ],

3 配置菜单(Admin.store.NavigationTree)

1  {2     text: 'Widget Grid',3     view: 'main.SRFX',4     leaf: true,5     iconCls: 'x-fa fa-times-circle',6     routeId: 'SRFX'7 },

4 定义视图和模型等

 在\classic\src\view\main中新建 一个srfxd.js,其内容为:

 1 var store = Ext.create('Ext.data.Store', { 2   fields: ['name', 'progress'], 3   data: [ 4     { name: 'Lisa', progress: .159, sequence1: [1, 2, 4, 5, 4, 5], sequence2: [1, -2, 4, 5, 4, -5], sequence3: [1, -2, 4, 5, 4, -5] }, 5     { name: 'Bart', progress: .216, sequence1: [1, 2, 4, 5, 4, 5], sequence2: [1, -2, 4, 5, 4, -5], sequence3: [1, -2, 4, 5, 4, -5] }, 6     { name: 'Homer', progress: .55, sequence1: [1, 2, 4, 5, 4, 5], sequence2: [1, -2, 4, 5, 4, -5], sequence3: [1, -2, 4, 5, 4, -5] }, 7     { name: 'Maggie', progress: .167, sequence1: [1, 2, 4, 5, 4, 5], sequence2: [1, -2, 4, 5, 4, -5], sequence3: [1, -2, 4, 5, 4, -5] }, 8     { name: 'Marge', progress: .145, sequence1: [1, 2, 4, 5, 4, 5], sequence2: [1, -2, 4, 5, 4, -5], sequence3: [1, -2, 4, 5, 4, -5] } 9   ]10 });11 12 13 14 15 Ext.define('Admin.view.main.SRFX', {16   extend: 'Ext.grid.Panel',17   requires: [18     'Ext.grid.column.Action',19     'Ext.ProgressBarWidget',20     'Ext.slider.Widget',21     'Ext.sparkline.*'22   ],23   title: '收入分析',24   store: store,25   columns: [26     {27       text: 'Name',28       dataIndex: 'name'29     },30     {31       text: 'progress',32       xtype: 'widgetcolumn',33       width: 120,34       dataIndex: 'progress',35       widget: {36         xtype: 'progressbarwidget',37         textTpl: [38           '{percent:number("0")}% done'39         ]40       }41     }42     , {43       text: 'Line',44       width: 100,45       dataIndex: 'sequence2',46       xtype: 'widgetcolumn',47       widget: {48         xtype: 'sparklineline',49         tipTpl: 'Value: {y:number("0.00")}'50       }51     }52     , {53       text: 'Bar',54       width: 100,55       dataIndex: 'sequence2',56       xtype: 'widgetcolumn',57       widget: {58         xtype: 'sparklinebar'59       }60     }, {61       text: 'Bullet',62       width: 100,63       dataIndex: 'sequence3',64       xtype: 'widgetcolumn',65       widget: {66         xtype: 'sparklinebullet'67       }68     }69   ],70   height: 350,71   width: 600,72   // renderTo: Ext.getBody()73 });

 5 sencha app watch查看

Sencha ExtJS 6 Widget Grid 入门

  

 




原标题:Sencha ExtJS 6 Widget Grid 入门

关键词:JS

JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

丰南专线:https://www.goluckyvip.com/tag/98086.html
东莞至南通货运专线:https://www.goluckyvip.com/tag/98087.html
东莞东莞专线:https://www.goluckyvip.com/tag/98088.html
邵东专线:https://www.goluckyvip.com/tag/98089.html
敦煌网招商:https://www.goluckyvip.com/tag/9809.html
东京专线:https://www.goluckyvip.com/tag/98091.html
深圳到西安自驾路线攻略 深圳到西安自驾最佳路线:https://www.vstour.cn/a/411228.html
松花蛋是哪里的特产松花蛋的产地:https://www.vstour.cn/a/411229.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流