cashless2ecash

cashless2ecash: pay with cards for digital cash (experimental)
Log | Files | Refs | README

main.js (1593B)


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