0.3.0 • Published 3 years ago

@slickgrid-universal/file-export v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

License: MIT TypeScript lerna npm npm

CircleCI Cypress.io jest codecov

Export Service (text file)

@slickgrid-universal/file-export

Simple Export to File Service that allows to export as CSV or Text, user can also choose which separator to use (comma, colon, semicolon, ...).

There are a couple of reasons to use this package (instead of the excel-export)

  • if you want to export to a text file with any type of separator (tab, colon, semicolon, comma)
  • if you have a very large dataset, this export consumes a lot less memory compare to the excel-export

Dependencies

This package requires text-encoding-utf-8 which is use to ensure proper UTF-8 encoding, even emoji will be exported without issues.

Installation

Follow the instruction provided in the main README, you can see a demo by looking at the GitHub Demo page and click on "Export to CSV" from the Grid Menu (aka hamburger menu).

Usage

In order to use the Service, you will need to register it in your grid options via the registerExternalServices as shown below.

ViewModel
import { FileExportService } from '@slickgrid-universal/file-export';

export class MyExample {
  prepareGrid {
    this.gridOptions = {
      enableExport: true,
      exportOptions: {
        sanitizeDataExport: true
      },
      registerExternalServices: [new FileExportService()],
    }
  }
}

If you wish to reference the service to use it with external export button, then simply create a reference while instantiating it.

import { FileExportService } from '@slickgrid-universal/file-export';

export class MyExample {
  exportService = new FileExportService();

  prepareGrid {
    this.gridOptions = {
      enableExport: true,
      exportOptions: {
        sanitizeDataExport: true
      },
      registerExternalServices: [this.exportService],
    }
  }

  exportToFile() {
    this.exportService.exportToFile({ filename: 'export', format: FileType.csv });
  }
}
0.3.0

3 years ago

0.2.15

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.7

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.1

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.1.0

4 years ago