From 7fe9a4ec8fdf93be2b848cb5f23fd0a3c3dbf338 Mon Sep 17 00:00:00 2001 From: Louis LIN Date: Sat, 2 Jun 2018 11:49:49 +0200 Subject: [PATCH] docs(#1244): fix buttons example for excel export --- demo/angular.json | 4 +++- demo/package.json | 1 + .../extensions/buttons-extension-configuration.component.ts | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/demo/angular.json b/demo/angular.json index fbe4844af..7009cb24d 100644 --- a/demo/angular.json +++ b/demo/angular.json @@ -34,6 +34,7 @@ "scripts": [ "node_modules/jquery/dist/jquery.js", "node_modules/tether/dist/js/tether.js", + "node_modules/jszip/dist/jszip.js", "node_modules/datatables.net/js/jquery.dataTables.js", "node_modules/datatables.net-buttons/js/dataTables.buttons.js", "node_modules/datatables.net-buttons/js/buttons.colVis.js", @@ -93,6 +94,7 @@ "node_modules/jquery/dist/jquery.js", "node_modules/tether/dist/js/tether.js", "node_modules/datatables.net/js/jquery.dataTables.js", + "node_modules/jszip/dist/jszip.js", "node_modules/datatables.net-buttons/js/dataTables.buttons.js", "node_modules/datatables.net-buttons/js/buttons.colVis.js", "node_modules/datatables.net-buttons/js/buttons.flash.js", @@ -169,4 +171,4 @@ "prefix": "app" } } -} \ No newline at end of file +} diff --git a/demo/package.json b/demo/package.json index 8c880505c..5ac475e0b 100644 --- a/demo/package.json +++ b/demo/package.json @@ -37,6 +37,7 @@ "datatables.net-select-dt": "^1.2.3", "highlight.js": "^9.12.0", "jquery": "^3.2.1", + "jszip": "^3.1.5", "materialize-css": "0.100.2", "rxjs": "^6.1.0", "rxjs-compat": "^6.1.0", diff --git a/demo/src/app/extensions/buttons-extension-configuration.component.ts b/demo/src/app/extensions/buttons-extension-configuration.component.ts index 07ae2a9b7..e610d9ff5 100644 --- a/demo/src/app/extensions/buttons-extension-configuration.component.ts +++ b/demo/src/app/extensions/buttons-extension-configuration.component.ts @@ -15,13 +15,16 @@ import { Component } from '@angular/core';

.angular-cli.json

Add the dependencies in the scripts and styles attributes:

+
If you want to have the excel export functionnality, then you must import the jszip.js before the buttons.html5.js file.
` }) export class ButtonsExtensionConfigurationComponent { npmInstallSnippet = `
-# JS file
+# If you want to export excel files
+npm install jszip --save
+# JS file
 npm install datatables.net-buttons --save
 # CSS file
 npm install datatables.net-buttons-dt --save
@@ -41,6 +44,7 @@ npm install @types/datatables.net-buttons --save-dev
       ],
       "scripts": [
         ...
+        "../node_modules/jszip/dist/jszip.js",
         "../node_modules/datatables.net-buttons/js/dataTables.buttons.js",
         "../node_modules/datatables.net-buttons/js/buttons.colVis.js",
         "../node_modules/datatables.net-buttons/js/buttons.flash.js",