buttons.bootstrap.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*! Bootstrap integration for DataTables' Buttons
  2. * ©2016 SpryMedia Ltd - datatables.net/license
  3. */
  4. (function( factory ){
  5. if ( typeof define === 'function' && define.amd ) {
  6. // AMD
  7. define( ['jquery', 'datatables.net-bs', 'datatables.net-buttons'], function ( $ ) {
  8. return factory( $, window, document );
  9. } );
  10. }
  11. else if ( typeof exports === 'object' ) {
  12. // CommonJS
  13. module.exports = function (root, $) {
  14. if ( ! root ) {
  15. root = window;
  16. }
  17. if ( ! $ || ! $.fn.dataTable ) {
  18. $ = require('datatables.net-bs')(root, $).$;
  19. }
  20. if ( ! $.fn.dataTable.Buttons ) {
  21. require('datatables.net-buttons')(root, $);
  22. }
  23. return factory( $, root, root.document );
  24. };
  25. }
  26. else {
  27. // Browser
  28. factory( jQuery, window, document );
  29. }
  30. }(function( $, window, document, undefined ) {
  31. 'use strict';
  32. var DataTable = $.fn.dataTable;
  33. $.extend( true, DataTable.Buttons.defaults, {
  34. dom: {
  35. container: {
  36. className: 'dt-buttons btn-group'
  37. },
  38. button: {
  39. className: 'btn btn-default'
  40. },
  41. collection: {
  42. tag: 'ul',
  43. className: 'dropdown-menu',
  44. closeButton: false,
  45. button: {
  46. tag: 'li',
  47. className: 'dt-button',
  48. active: 'active',
  49. disabled: 'disabled'
  50. },
  51. buttonLiner: {
  52. tag: 'a',
  53. className: ''
  54. }
  55. },
  56. splitWrapper: {
  57. tag: 'div',
  58. className: 'dt-btn-split-wrapper btn-group',
  59. closeButton: false,
  60. },
  61. splitDropdown: {
  62. tag: 'button',
  63. text: '▼',
  64. className: 'btn btn-default dt-btn-split-drop dropdown-toggle',
  65. closeButton: false,
  66. align: 'split-left',
  67. splitAlignClass: 'dt-button-split-left'
  68. },
  69. splitDropdownButton: {
  70. tag: 'button',
  71. className: 'dt-btn-split-drop-button btn btn-default',
  72. closeButton: false
  73. }
  74. }
  75. } );
  76. DataTable.ext.buttons.collection.text = function ( dt ) {
  77. return dt.i18n('buttons.collection', 'Collection <span class="caret"/>');
  78. };
  79. return DataTable.Buttons;
  80. }));