导出数据表仅显示首页而不显示所有详细信息

时间:2019-01-29 12:47:57

标签: jquery laravel

jQuery Laravel中使用的数据表。单击导出按钮时,它仅显示首页csv。但是,我需要所有页面详细信息。

 $(window).on('load',function () {
 //  $.fn.dataTable.Buttons.swfPath = '{{ asset('admin/js/swf/flashExport.swf') }}';//include datatable button
 oTable = $('#table').DataTable({

         "scrollX": true,
         "sScrollY": "200px",
        "oLanguage": {

            "sProcessing": "{{ trans('table.processing') }}",
            "sInfo": "Showing _START_ to _END_ of _TOTAL_ teams", "sInfoEmpty": "Showing 0 to 0 of 0 teams",
            "sUrl": "",
             "sSearch": "" ,
            "sType": "html",

            "pagingType": "full_numbers",
            "oPaginate": {
                "sFirst": "<i class='fa fa-caret-left'></i><i class='fa fa-caret-left'></i>",
                "sPrevious": "<i class='fa fa-caret-left'></i>",
                "sNext": "<i class='fa fa-caret-right'></i>",
                "sLast": "<i class='fa fa-caret-right'></i><i class='fa fa-caret-right'></i>"

            },
        },

        "processing": true,
        "serverSide": true,

       "order": [],           
        ajax: {
            url: '{{ url('admin/teams/data') }}',
            data: function (d) {
                d.district_id = district_id;
                d.school_id = school_id;                                    
            }
        },  
        columns: [

                {data: 'teamName', name: 'teamName',orderable: true, searchable: true},
                {data: 'shoppingCode', name: 'shoppingCode',orderable: true, searchable: true},
                {data: 'school', name: 'school',orderable: true, searchable: true},
                {data: 'district', name: 'district',orderable: true, searchable: true},
                {data: 'subscribers', name: 'subscribers',orderable: true, searchable: false},
                {data: 'tCity', name: 'tCity',orderable: true, searchable: true},
                {data: 'tState', name: 'tState',orderable: true, searchable: true},
                {data: 'admincount', name: 'admincount',orderable: true, searchable: false},
                {data: 'created_at', name: 'created_at',orderable: true, searchable: false},
                {data: 'status', name: 'status',orderable: false, searchable: false},                   
                {data: 'actions', name: 'actions',orderable: false, searchable: false},  
                {data: 'status_1', name: 'status_1',orderable: false, searchable: false,visible:false},  
            ],            
             "dom": '<"top"Bf>lt<"bottom"lip><"clear">',//include datatable button
             "buttons":[
                {
               tableTools: {
      "sSwfPath": "admin/js/swf/flashExport.swf"
    },
                        extend: 'csvHtml5',
                        title:'Teams_{{!! date("Y-m-d") !!}}',//csv teams title
                        text: 'Export',
                        className: 'btn btn-default',
                        exportOptions: {

                             modifier : {
                    // DataTables core
                    columns: [0, 1, 2, 3, 4, 5, 6, 7, 8,11],
                    order : 'current',  // 'current', 'applied', 'index',  'original'
                    page : 'all',      // 'all',     'current'
                    search : 'applied'     // 'none',    'applied', 'removed'
                }
                        }


                },

            ],
            'columnDefs': [{
                              "targets": [4,7], 
                              "className": "text-right",                                  
                         }
            ],

    });
    $(".dataTables_filter").addClass("search"); 
    $("#table_filter input").attr("placeholder", "Search");
});

1 个答案:

答案 0 :(得分:0)

检查ajax是否返回所有行或仅返回第一页。如果您在laravel中设置了限制,请将其设置为提供的数据表输入。