Export

Enable Exporting

FancyGrid supports Excel and CSV exporting.
To enable it, it requires to set exporter: true.
For exporting to Excel there is method exportToExcel.
For exporting to CSV there is method exportToCSV.


var grid = new FancyGrid({
  exporter: true,
  tbar: [{
    text: 'Export to Excel',
    handler: function() {
      this.exportToExcel();
    }
  }, {
    text: 'Export to CSV',
    handler: function() {
      this.exportToCSV({
        fileName: 'myCSV',
        header: true,
		all: true
      });
    }
  }],
  ...

By default it exports only visually displayed data.
To export all data it requires to set property all: true.

Sample:


grid.exportToCSV({
  header: true,
  all: true
});

Customizing data

To change data during exporting there are 2 columns properties:
exportFn and exportable.


var grid = new FancyGrid({
  exporter: true,
  columns: [{
    type: 'string',
    title: 'Name',
    index: 'name',
    width: 80,
    exportFn: function(o){
	  o.value = o.data.name + ' ' + o.data.surname;
	
	  return o;
    }
  },{
    index: 'surname',
    exportable: false,
    title: 'Sur Name'
  },{
  ...

Excel

Method exportToExcel accept 2 properties: fileName and header.
Doc link exportToExcel

CSV

Method exportToCSV accept 3 properties: fileName, header, separator.
Doc link exportToCSV

Samples

Exporting
Customizing data

See also

Method exportToCSV
Method exportToExcel

Property exportFn
Property exportable

`