var datatable;
var columnspez = columns;
columnspez.splice(3, 0, { title: "Quelle",orderable:false, data: "source",className:"dt-source" });

$(document).ready(function(){
    datatable = $('#scheduled').DataTable({
        paging: false,
        searching:true,
        scrollX:false,
        info:false, 
        order: [[ 1, 'asc' ]],
        ajax: {url: '/Ajax/getScheduledData',dataSrc:''},
        layout: {
            topStart: {
                buttons: [
                    {text:'Neue Rechnung',className:'btn-sm',action: function ( e, dt, node, config ) {
                        location.href = '/newScheduled';
                    }},
                    {text:'Neuer Transfer',className:'btn-sm mx-2',action: function ( e, dt, node, config ) {
                        location.href = '/newScheduledTransfer';
                    }},
                    ]
            },
            topEnd: 'search'
        },
        columns: columnspez
    });
    
    $('#scheduled tbody').on('click', 'td.dt-receiver', function () {collapseDetails($(this), datatable);} );
    $('#scheduled tbody').on('click', 'td.dt-datum', function () {location.href = '/editScheduled/'+getId($(this),datatable);});
    $('#scheduled tbody').on('click', 'table.tabdet', function () {location.href = '/editScheduled/'+$(this).attr('data-bs-id');});
});
