[7304c7f] | 1 | /*! Bootstrap integration for DataTables' Buttons
|
---|
| 2 | * ©2016 SpryMedia Ltd - datatables.net/license
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | (function( factory ){
|
---|
| 6 | if ( typeof define === 'function' && define.amd ) {
|
---|
| 7 | // AMD
|
---|
| 8 | define( ['jquery', 'datatables.net-bs4', 'datatables.net-buttons'], function ( $ ) {
|
---|
| 9 | return factory( $, window, document );
|
---|
| 10 | } );
|
---|
| 11 | }
|
---|
| 12 | else if ( typeof exports === 'object' ) {
|
---|
| 13 | // CommonJS
|
---|
| 14 | module.exports = function (root, $) {
|
---|
| 15 | if ( ! root ) {
|
---|
| 16 | root = window;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | if ( ! $ || ! $.fn.dataTable ) {
|
---|
| 20 | $ = require('datatables.net-bs4')(root, $).$;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | if ( ! $.fn.dataTable.Buttons ) {
|
---|
| 24 | require('datatables.net-buttons')(root, $);
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | return factory( $, root, root.document );
|
---|
| 28 | };
|
---|
| 29 | }
|
---|
| 30 | else {
|
---|
| 31 | // Browser
|
---|
| 32 | factory( jQuery, window, document );
|
---|
| 33 | }
|
---|
| 34 | }(function( $, window, document, undefined ) {
|
---|
| 35 | 'use strict';
|
---|
| 36 | var DataTable = $.fn.dataTable;
|
---|
| 37 |
|
---|
| 38 | $.extend( true, DataTable.Buttons.defaults, {
|
---|
| 39 | dom: {
|
---|
| 40 | container: {
|
---|
| 41 | className: 'dt-buttons btn-group flex-wrap'
|
---|
| 42 | },
|
---|
| 43 | button: {
|
---|
| 44 | className: 'btn btn-secondary'
|
---|
| 45 | },
|
---|
| 46 | collection: {
|
---|
| 47 | tag: 'div',
|
---|
| 48 | className: 'dropdown-menu',
|
---|
| 49 | button: {
|
---|
| 50 | tag: 'a',
|
---|
| 51 | className: 'dt-button dropdown-item',
|
---|
| 52 | active: 'active',
|
---|
| 53 | disabled: 'disabled'
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 | },
|
---|
| 57 | buttonCreated: function ( config, button ) {
|
---|
| 58 | return config.buttons ?
|
---|
| 59 | $('<div class="btn-group"/>').append(button) :
|
---|
| 60 | button;
|
---|
| 61 | }
|
---|
| 62 | } );
|
---|
| 63 |
|
---|
| 64 | DataTable.ext.buttons.collection.className += ' dropdown-toggle';
|
---|
| 65 | DataTable.ext.buttons.collection.rightAlignClassName = 'dropdown-menu-right';
|
---|
| 66 |
|
---|
| 67 | return DataTable.Buttons;
|
---|
| 68 | }));
|
---|