Skip to content

Commit

Permalink
feat(exporter): add export type in format method (#7223)
Browse files Browse the repository at this point in the history
Co-authored-by: n.lopez <[email protected]>
  • Loading branch information
NicolasLOJO and n.lopez authored Oct 3, 2022
1 parent 2c4d5b4 commit 4c36808
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/exporter/src/js/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
var service = {

delay: 100,
type: null,

initializeGrid: function (grid) {

Expand Down Expand Up @@ -854,6 +855,7 @@
*/
csvExport: function (grid, rowTypes, colTypes) {
var self = this;
self.type = 'csv';
this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function() {
var exportColumnHeaders = grid.options.showHeader ? self.getColumnHeaders(grid, colTypes) : [];
var exportData = self.getData(grid, rowTypes, colTypes);
Expand Down Expand Up @@ -1083,8 +1085,8 @@
gridCol.colDef.exporterSuppressExport !== true && gridCol.field !== '$$hashKey' &&
grid.options.exporterSuppressColumns.indexOf( gridCol.name ) === -1 ) {
var cellValue = applyCellFilters ? grid.getCellDisplayValue( row, gridCol ) : grid.getCellValue( row, gridCol ),
extractedField = { value: grid.options.exporterFieldCallback( grid, row, gridCol, cellValue ) },
extension = grid.options.exporterFieldFormatCallback( grid, row, gridCol, cellValue );
extractedField = { value: grid.options.exporterFieldCallback( grid, row, gridCol, cellValue, service.type ) },
extension = grid.options.exporterFieldFormatCallback( grid, row, gridCol, cellValue, service.type );

if (extension) {
Object.assign(extractedField, extension);
Expand Down Expand Up @@ -1290,7 +1292,7 @@
*/
pdfExport: function (grid, rowTypes, colTypes) {
var self = this;

self.type = 'pdf';
this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function () {
var exportColumnHeaders = self.getColumnHeaders(grid, colTypes),
exportData = self.getData(grid, rowTypes, colTypes),
Expand Down Expand Up @@ -1635,6 +1637,7 @@

excelExport: function (grid, rowTypes, colTypes) {
var self = this;
self.type = 'excel';
this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function() {
var exportColumnHeaders = grid.options.showHeader ? self.getColumnHeaders(grid, colTypes) : [];

Expand Down

0 comments on commit 4c36808

Please sign in to comment.