What is datatables.net-buttons?
The datatables.net-buttons package is an extension for the DataTables library that provides a set of buttons for various functionalities such as exporting data, printing, and column visibility control. It enhances the interactivity and usability of DataTables by allowing users to perform actions directly from the table interface.
What are datatables.net-buttons's main functionalities?
Export to CSV
This feature allows users to export the table data to a CSV file. The code initializes a DataTable with a button that, when clicked, exports the data to a CSV file.
var table = $('#example').DataTable({
dom: 'Bfrtip',
buttons: [
'csv'
]
});
Export to Excel
This feature allows users to export the table data to an Excel file. The code initializes a DataTable with a button that, when clicked, exports the data to an Excel file.
var table = $('#example').DataTable({
dom: 'Bfrtip',
buttons: [
'excel'
]
});
Print View
This feature allows users to print the table data. The code initializes a DataTable with a button that, when clicked, opens a print view of the table data.
var table = $('#example').DataTable({
dom: 'Bfrtip',
buttons: [
'print'
]
});
Column Visibility
This feature allows users to control the visibility of columns in the table. The code initializes a DataTable with a button that, when clicked, provides options to show or hide columns.
var table = $('#example').DataTable({
dom: 'Bfrtip',
buttons: [
'colvis'
]
});
Other packages similar to datatables.net-buttons
tableexport
The tableexport package provides functionalities to export HTML tables to various formats such as CSV, Excel, and PDF. It is similar to datatables.net-buttons in terms of export capabilities but does not offer features like print view or column visibility control.
jspdf-autotable
The jspdf-autotable package allows users to export HTML tables to PDF format. It is focused on PDF export and offers more customization options for PDF generation compared to datatables.net-buttons, but it lacks other export formats and features like print view and column visibility.
react-data-export
The react-data-export package is designed for React applications and provides functionalities to export data to Excel. It is similar to datatables.net-buttons in terms of Excel export but is specifically tailored for React, lacking other features like print view and column visibility.
Buttons for DataTables
This package contains distribution files for the Buttons extension for DataTables. Only the core software for this library is contained in this package - to be correctly styled, a styling package for Buttons must also be included. Styling options include DataTable's native styling, Bootstrap and Foundation.
The Buttons extension for DataTables provides a common set of options, API methods and styling to display buttons on a page that will interact with a DataTable. It also provides plug-ins for file export (HTML5 and Flash), print view and column visibility. Other libraries, such as Editor and Select also provide buttons specific to their use cases.
Installation
Browser
For inclusion of this library using a standard <script>
tag, rather than using this package, it is recommended that you use the DataTables download builder which can create CDN or locally hosted packages for you, will all dependencies satisfied.
npm
npm install datatables.net-buttons
ES3 Syntax
var $ = require( 'jquery' );
require( 'datatables.net-buttons' )( window, $ );
ES6 Syntax
import 'datatables.net-buttons'
bower
bower install --save datatables.net-buttons
Documentation
Full documentation and examples for Buttons can be found on the website.
Bug / Support
Support for DataTables is available through the DataTables forums and commercial support options are available.
Contributing
If you are thinking of contributing code to DataTables, first of all, thank you! All fixes, patches and enhancements to DataTables are very warmly welcomed. This repository is a distribution repo, so patches and issues sent to this repo will not be accepted. Instead, please direct pull requests to the DataTables/Buttons. For issues / bugs, please direct your questions to the DataTables forums.
License
This software is released under the MIT license. You are free to use, modify and distribute this software, but all copyright information must remain.