var datatable; var todos; $(document).ready(function(){ datatable = $('#bookings').DataTable({ paging: false, searching:true, scrollX:false, info:false, order: [[ 1, 'desc' ]], ajax: { url: '/Ajax/getOverviewData', dataSrc:''}, layout: { topStart: { buttons: [ {text:'Neue Rechnung',className:'btn-sm',action: function ( e, dt, node, config ) { location.href = '/newBill/'; }}, ] }, topEnd: 'search' }, // dom: '<"toolbar">frt', columns: columns, }); // $("div.toolbar").html('Neuer Eintrag'); // Add event listener for opening and closing details $('#bookings tbody').on('click', 'td.dt-receiver', function () {collapseDetails($(this), datatable);} ); $('#bookings tbody').on('click', 'td.dt-datum', function () {location.href = '/editBill/'+getId($(this),datatable);}); $('#bookings tbody').on('click', 'table.tabdet', function () {location.href = '/editBill/'+$(this).attr('data-bs-id');}); todos = $('#todos').DataTable({ paging: true, searching:true, scrollX:false, info:true, order: [[ 1, 'desc' ]], ajax: { url: '/Ajax/getToDosData', dataSrc:''}, layout: { topStart: { buttons: [ {text:'Sync',className:'btn-sm',action: syncScheduled}, ] }, topEnd: 'search' }, // dom: '<"top"i<"syncbutton">>frt<"bottom"lp><"clear">', columns: columns, }); // $("div.syncbutton").html('Sync'); // Add event listener for opening and closing details $('#todos tbody').on('click', 'td.dt-receiver', function () {collapseDetails($(this), todos);} ); $('#todos tbody').on('click', 'td.dt-datum', function () {location.href = '/editBill/'+getId($(this),todos);}); $('#todos tbody').on('click', 'table.tabdet', function () {location.href = '/editBill/'+$(this).attr('data-bs-id');}); });