1/* ------------------------------------------------------------------------------ 2* 3* # Buttons extension for Datatables. Print examples 4* 5* Specific JS code additions for datatable_extension_buttons_print.html page 6* 7* Version: 1.1 8* Latest update: Mar 6, 2016 9* 10* ---------------------------------------------------------------------------- */ 11 12$(function() { 13 14 15 // Table setup 16 // ------------------------------ 17 18 // Setting datatable defaults 19 $.extend( $.fn.dataTable.defaults, { 20 autoWidth: false, 21 dom: '<"datatable-header"fBl><"datatable-scroll-wrap"t><"datatable-footer"ip>', 22 language: { 23 search: '<span>Filter:</span> _INPUT_', 24 searchPlaceholder: 'Type to filter...', 25 lengthMenu: '<span>Show:</span> _MENU_', 26 paginate: { 'first': 'First', 'last': 'Last', 'next': '→', 'previous': '←' } 27 } 28 }); 29 30 31 // Basic initialization 32 $('.datatable-button-print-basic').DataTable({ 33 buttons: [ 34 { 35 extend: 'print', 36 text: '<i class="icon-printer position-left"></i> Print table', 37 className: 'btn bg-blue' 38 } 39 ] 40 }); 41 42 43 // Disable auto print 44 $('.datatable-button-print-disable').DataTable({ 45 buttons: [ 46 { 47 extend: 'print', 48 text: '<i class="icon-printer position-left"></i> Print table', 49 className: 'btn bg-blue', 50 autoPrint: false 51 } 52 ] 53 }); 54 55 56 // Export options - column selector 57 $('.datatable-button-print-columns').DataTable({ 58 columnDefs: [{ 59 targets: -1, // Hide actions column 60 visible: false 61 }], 62 buttons: [ 63 { 64 extend: 'print', 65 text: '<i class="icon-printer position-left"></i> Print table', 66 className: 'btn btn-default', 67 exportOptions: { 68 columns: ':visible' 69 } 70 }, 71 { 72 extend: 'colvis', 73 text: '<i class="icon-three-bars"></i> <span class="caret"></span>', 74 className: 'btn btn-default btn-icon' 75 } 76 ] 77 }); 78 79 80 // Export options - row selector 81 $('.datatable-button-print-rows').DataTable({ 82 buttons: { 83 buttons: [ 84 { 85 extend: 'print', 86 className: 'btn btn-default', 87 text: '<i class="icon-printer position-left"></i> Print all' 88 }, 89 { 90 extend: 'print', 91 className: 'btn btn-default', 92 text: '<i class="icon-checkmark3 position-left"></i> Print selected', 93 exportOptions: { 94 modifier: { 95 selected: true 96 } 97 } 98 } 99 ], 100 }, 101 select: true 102 }); 103 104 105 106 // External table additions 107 // ------------------------------ 108 109 // Enable Select2 select for the length option 110 $('.dataTables_length select').select2({ 111 minimumResultsForSearch: Infinity, 112 width: 'auto' 113 }); 114 115});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.