1 | /*! Foundation 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-zf', '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-zf')(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 |
|
---|
39 | // F6 has different requirements for the dropdown button set. We can use the
|
---|
40 | // Foundation version found by DataTables in order to support both F5 and F6 in
|
---|
41 | // the same file, but not that this requires DataTables 1.10.11+ for F6 support.
|
---|
42 | var collection = DataTable.ext.foundationVersion === 6 ?
|
---|
43 | {
|
---|
44 | tag: 'div',
|
---|
45 | className: 'dropdown-pane is-open button-group stacked'
|
---|
46 | } :
|
---|
47 | {
|
---|
48 | tag: 'ul',
|
---|
49 | className: 'f-dropdown open dropdown-pane is-open',
|
---|
50 | button: {
|
---|
51 | tag: 'li',
|
---|
52 | className: 'small',
|
---|
53 | active: 'active',
|
---|
54 | disabled: 'disabled'
|
---|
55 | },
|
---|
56 | buttonLiner: {
|
---|
57 | tag: 'a'
|
---|
58 | }
|
---|
59 | };
|
---|
60 |
|
---|
61 | $.extend( true, DataTable.Buttons.defaults, {
|
---|
62 | dom: {
|
---|
63 | container: {
|
---|
64 | tag: 'div',
|
---|
65 | className: 'dt-buttons button-group'
|
---|
66 | },
|
---|
67 | buttonContainer: {
|
---|
68 | tag: null,
|
---|
69 | className: ''
|
---|
70 | },
|
---|
71 | button: {
|
---|
72 | tag: 'a',
|
---|
73 | className: 'button small',
|
---|
74 | active: 'secondary'
|
---|
75 | },
|
---|
76 | buttonLiner: {
|
---|
77 | tag: null
|
---|
78 | },
|
---|
79 | collection: collection
|
---|
80 | }
|
---|
81 | } );
|
---|
82 |
|
---|
83 |
|
---|
84 | DataTable.ext.buttons.collection.className = 'dropdown';
|
---|
85 |
|
---|
86 |
|
---|
87 | return DataTable.Buttons;
|
---|
88 | }));
|
---|