Posts

Showing posts from February, 2021

SPFx - Display export buttons for Excel, CSV, PDF, Copy, Print, Column visibility in Datatable.net using Typescript

This is an example to display export buttons in datatables.net using typescript in SPFx. Install following references using 'npm'. npm install jquery npm install jquery-ui npm install datatables.net npm install  datatables.net-buttons npm install datatables.net-buttons-dt npm install jszip npm install pdfmake Import references in webpart file . import * as $ from 'jquery'; import 'jquery-ui'; import 'DataTables.net'; import 'datatables.net-buttons'; import 'datatables.net-buttons-dt'; import 'pdfmake/build/pdfmake'; import * as JSZip from 'jszip'; //most important for excel button //Export to PDF import pdfMake from "pdfmake/build/pdfmake"; import pdfFonts from "pdfmake/build/vfs_fonts"; pdfMake.vfs = pdfFonts.pdfMake.vfs; // most important for PDF Now give reference to the webpart file .  require('../../../node_modules/datatables.net-dt/css/jquery.dataTables.min.css'); require('../../../n...