routines.js (2069B)
1 var filterBy = function(functionType) { 2 $.fn.dataTableExt.afnFiltering.length = 0; 3 $.fn.dataTable.ext.search.push( 4 function( settings, data, dataIndex ) { 5 var type = data[1]; // use data for the Type column 6 7 if ( type.toUpperCase() == functionType || functionType == 'All' ) 8 { 9 return true; 10 } 11 return false; 12 } 13 ); 14 } 15 16 $(document).ready(function() { 17 var activeObject; 18 var table = $('#routine_table').DataTable( { 19 lengthChange: false, 20 ordering: true, 21 paging: config.pagination, 22 pageLength: 50, 23 autoWidth: true, 24 processing: true, 25 order: [[ 0, "asc" ]], 26 buttons: [ 27 { 28 text: 'All', 29 action: function ( e, dt, node, config ) { 30 filterBy('All'); 31 if (activeObject != null) { 32 activeObject.active(false); 33 } 34 table.draw(); 35 } 36 }, 37 { 38 text: 'Functions', 39 action: function ( e, dt, node, config ) { 40 filterBy('FUNCTION'); 41 if (activeObject != null) { 42 activeObject.active(false); 43 } 44 this.active( !this.active() ); 45 activeObject = this; 46 table.draw(); 47 } 48 }, 49 { 50 text: 'Procedures', 51 action: function ( e, dt, node, config ) { 52 filterBy('PROCEDURE'); 53 if (activeObject != null) { 54 activeObject.active(false); 55 } 56 this.active( !this.active() ); 57 activeObject = this; 58 table.draw(); 59 } 60 }, 61 { 62 extend: 'columnsToggle', 63 columns: '.toggle' 64 } 65 ] 66 } ); 67 68 //schemaSpy.js 69 dataTableExportButtons(table); 70 } );