123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- /**
- * This example illustrates how to use the "gridexporter" plugin.
- */
- Ext.define('uas.view.grid.Exporter', {
- extend: 'Ext.grid.Panel',
- xtype: 'grid-exporter',
- controller: 'grid-exporter',
- requires: [
- 'Ext.grid.plugin.Exporter'
- ],
- loadMask: true,
- plugins: {
- gridexporter: true
- },
- store: {
- type: 'products',
- autoLoad: true,
- },
- features: [{
- ftype : 'groupingsummary',
- groupHeaderTpl : '{name}',
- hideGroupedHeader : false,
- enableGroupingMenu : false
- }, {
- ftype: 'summary',
- dock: 'bottom'
- }],
- listeners: {
- // this event notifies us when the document was saved
- documentsave: 'onDocumentSave',
- beforedocumentsave: 'onBeforeDocumentSave',
- dataready: 'onDataReady'
- },
- columns: [{
- dataIndex: 'id',
- text: 'Id',
- width: 50
- }, {
- dataIndex: 'company',
- text: 'Company',
- flex: 1,
- summaryType: 'count'
- }, {
- text: 'Info',
- columns: [{
- dataIndex: 'price',
- text: 'Price',
- width: 90,
- formatter: 'usMoney',
- summaryType: 'sum',
- summaryFormatter: 'usMoney',
- // you can define an export style for a column
- // you can set alignment, format etc
- exportStyle: [{
- // no type key is defined here which means that this is the default style
- // that will be used by all exporters
- format: 'Currency',
- alignment: {
- horizontal: 'Right'
- }
- },{
- // the type key means that this style will only be used by the html exporter
- // and for all others the default one, defined above, will be used
- type: 'html',
- format: 'Currency',
- alignment: {
- horizontal: 'Right'
- },
- font: {
- bold: true,
- italic: true
- }
- }]
- }, {
- dataIndex: 'size',
- text: 'Size',
- width: 120
- }, {
- xtype: 'datecolumn',
- dataIndex: 'date',
- text: 'Date',
- width: 120,
- // you can define an export style for a column
- // you can set alignment, format etc
- exportStyle: {
- alignment: {
- horizontal: 'Right'
- },
- format: 'Short Date'
- }
- }, {
- dataIndex: 'visible',
- text: 'Visible',
- width: 80,
- // some columns can be ignored during export
- ignoreExport: true
- }]
- }],
- header: {
- itemPosition: 1, // after title before collapse tool
- items: [{
- ui: 'default-toolbar',
- xtype: 'button',
- text: 'Export to ...',
- menu: {
- defaults: {
- handler: 'exportTo'
- },
- items: [{
- text: 'Excel xlsx',
- cfg: {
- type: 'excel07',
- ext: 'xlsx'
- }
- },{
- text: 'Excel xlsx (include groups)',
- cfg: {
- type: 'excel07',
- ext: 'xlsx',
- includeGroups: true,
- includeSummary: true
- }
- },{
- text: 'Excel xml',
- cfg: {
- type: 'excel03',
- ext: 'xml'
- }
- },{
- text: 'Excel xml (include groups)',
- cfg: {
- includeGroups: true,
- includeSummary: true,
- type: 'excel03',
- ext: 'xml'
- }
- },{
- text: 'CSV',
- cfg: {
- type: 'csv'
- }
- },{
- text: 'TSV',
- cfg: {
- type: 'tsv',
- ext: 'csv'
- }
- },{
- text: 'HTML',
- cfg: {
- type: 'html'
- }
- },{
- text: 'HTML (include groups)',
- cfg: {
- type: 'html',
- includeGroups: true,
- includeSummary: true
- }
- }]
- }
- }]
- }
- });
|