代码高亮测试

Ext.define('App.MainFileGrid', { extend: 'Ext.grid.Panel', alias: 'widget.MainFileGrid', initComponent: function(){ var store = Ext.create('Ext.data.DirectStore', { autoLoad: true, autoSync: true, remoteSort: true, api: { create: MyApp.FileAction.Create, read: MyApp.FileAction.Load, update: MyApp.FileAction.Update, destroy: MyApp.FileAction.Destroy }, idProperty: 'id', totalProperty: 'total', root: 'data', sorters: [{ property: 'datetimeCreated', direction: 'DESC' }], fields: ['id','title', 'classId',{ name: 'datetimeCreated', type: 'date', dateFormat: 'c' }, 'docAbstract','typeId'] }); var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { autoCancel: false, clicksToMoveEditor: 1, autoCancel: true }); Ext.apply( this, { store: store, selModel: Ext.create('Ext.selection.RowModel', { mode: 'SINGLE', listeners: { scope: this, select: this.onSelect } }), columns: [ { header: '文档', dataIndex: 'title', flex: 1, renderer: function(value, o, record) { return Ext. String.format('<div class=" topic"><b>{0}</b><span class=" author">{1}</span></div>', value, record.get('author')); }, editor: { // defaults to textfield if no xtype is supplied allowBlank: false } }, { header: '类别', dataIndex: 'classId', 100, editor: { // defaults to textfield if no xtype is supplied allowBlank: false } //hidden: true }, { header: '文件类型', dataIndex: 'typeId', 70, align: 'right', editor: { // defaults to textfield if no xtype is supplied allowBlank: false } }, { header: '时间', dataIndex: 'datetimeCreated', renderer : Ext.util.Format.dateRenderer('Y年m月d日'), 150, field: { xtype: 'datefield', allowBlank: false, format: 'm/d/Y', minValue: '01/01/2006', minText: 'Cannot have a start date before the company existed!', maxValue: Ext. Date.format( new Date(), 'm/d/Y') } } ], dockedItems: [{ xtype: ' toolbar', cls: 'x-docked-noborder- top', items: [{ text: '新文件', iconCls: 'icon- new-topic', handler: function(){ alert('Not implemented'); } }, '-', { text: '显示详细信息', iconCls: 'icon-preview', enableToggle: true, pressed: true, scope: this, toggleHandler: this.onPreviewChange }, { text: '摘要', iconCls: 'icon-summary', enableToggle: true, pressed: true, scope: this, toggleHandler: this.onSummaryChange }] }, { dock: 'bottom', xtype: 'pagingtoolbar', store: store, displayInfo: true, displayMsg: '显示 {0} - {1} 共 {2} 文档', emptyMsg: '该分类下无文档' }], plugins: [rowEditing] }); this.callParent(); }, onSelect: function(selModel, rec){ this.ownerCt.onSelect(rec); }, loadForum: function(id){ var store = this.store; store.getProxy().extraParams.forumId = id; store.loadPage(1); }, onPreviewChange: function(btn, pressed){ this.ownerCt.togglePreview(pressed); }, onSummaryChange: function(btn, pressed){ this.getView().getPlugin('preview').toggleExpanded(pressed); }});
Ext.define( ' App.MainFileGrid ' , { extend: ' Ext.grid.Panel ' , alias: ' widget.MainFileGrid ' , initComponent: function (){ var store = Ext.create( ' Ext.data.DirectStore ' , { autoLoad: true , autoSync: true , remoteSort: true , api: { create: MyApp.FileAction.Create, read: MyApp.FileAction.Load, update: MyApp.FileAction.Update, destroy: MyApp.FileAction.Destroy }, idProperty: ' id ' , totalProperty: ' total ' , root: ' data ' , sorters: [{ property: ' datetimeCreated ' , direction: ' DESC ' }], fields: [ ' id ' , ' title ' , ' classId ' ,{ name: ' datetimeCreated ' , type: ' date ' , dateFormat: ' c ' }, ' docAbstract ' , ' typeId ' ] }); var rowEditing = Ext.create( ' Ext.grid.plugin.RowEditing ' , { autoCancel: false , clicksToMoveEditor: 1 , autoCancel: true }); Ext.apply( this , { store: store, selModel: Ext.create( ' Ext.selection.RowModel ' , { mode: ' SINGLE ' , listeners: { scope: this , select: this .onSelect } }), columns: [ { header: ' 文档 ' , dataIndex: ' title ' , flex: 1 , renderer: function (value, o, record) { return Ext.String.format( ' <div class="topic"><b>{0}</b><span class="author">{1}</span></div> ' , value, record.get( ' author ' )); }, editor: { // defaults to textfield if no xtype is supplied allowBlank: false } }, { header: ' 类别 ' , dataIndex: ' classId ' , 100 , editor: { // defaults to textfield if no xtype is supplied allowBlank: false } // hidden: true }, { header: ' 文件类型 ' , dataIndex: ' typeId ' , 70 , align: ' right ' , editor: { // defaults to textfield if no xtype is supplied allowBlank: false } }, { header: ' 时间 ' , dataIndex: ' datetimeCreated ' , renderer : Ext.util.Format.dateRenderer( ' Y年m月d日 ' ), 150 , field: { xtype: ' datefield ' , allowBlank: false , format: ' m/d/Y ' , minValue: ' 01/01/2006 ' , minText: ' Cannot have a start date before the company existed! ' , maxValue: Ext.Date.format( new Date(), ' m/d/Y ' ) } } ], dockedItems: [{ xtype: ' toolbar ' , cls: ' x-docked-noborder-top ' , items: [{ text: ' 新文件 ' , iconCls: ' icon-new-topic ' , handler: function (){ alert( ' Not implemented ' ); } }, ' - ' , { text: ' 显示详细信息 ' , iconCls: ' icon-preview ' , enableToggle: true , pressed: true , scope: this , toggleHandler: this .onPreviewChange }, { text: ' 摘要 ' , iconCls: ' icon-summary ' , enableToggle: true , pressed: true , scope: this , toggleHandler: this .onSummaryChange }] }, { dock: ' bottom ' , xtype: ' pagingtoolbar ' , store: store, displayInfo: true , displayMsg: ' 显示 {0} - {1} 共 {2} 文档 ' , emptyMsg: ' 该分类下无文档 ' }], plugins: [rowEditing] }); this .callParent(); }, onSelect: function (selModel, rec){ this .ownerCt.onSelect(rec); }, loadForum: function (id){ var store = this .store; store.getProxy().extraParams.forumId = id; store.loadPage( 1 ); }, onPreviewChange: function (btn, pressed){ this .ownerCt.togglePreview(pressed); }, onSummaryChange: function (btn, pressed){ this .getView().getPlugin( ' preview ' ).toggleExpanded(pressed); } });

你可能感兴趣的:(style,function,职场,休闲)