Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35607

How to export all pages of a table using server-side?

$
0
0

Hi everyone,

I was looking for how to export all pages in a table built with server-side, but all the answers didn't works here. If I choose to print came all data in the table, but the others options came only the current page.

Is it possible load the first page, draw the table and in background built the others pages?

My code is:

$(document).ready(function() {
    var oTable = $('#DistributorList').dataTable( {
        "order": [[ 0, "asc" ]],
        "paging":   true,
        "ordering": true,
        "info":     true,
        "pageLength": 50,
        "bLengthChange" : true,
        "processing": true,
        "serverSide": true,
        "pagingType": "full_numbers",
        "ajax": $.fn.dataTable.pipeline( {
            url: "/ajax/getSalonsList.php",
            pages: 100 // number of pages to cache
        } ),

        "aoColumns": [
            { "bSortable": true, "mDataProp": "SalonName"},
            { "bSortable": true, "mDataProp": "DistributorName" }, 
            { "bSortable": true, "mDataProp": "DSCName" }, 
            { "bSortable": true, "mDataProp": "BackBarCredits","sClass": "right" }, 
            { "bSortable": true, "mDataProp": "MarketingCredits","sClass": "right" }, 
            { "bSortable": true, "mDataProp": "ERetailCredits","sClass": "right" }, 
            { "bSortable": true, "mDataProp": "EBackBarCredits","sClass": "right" }, 
            { "bSortable": true, "mDataProp": "PromotionCredits","sClass": "right" }, 
            { "bSortable": true, "mDataProp": "EducationCredits","sClass": "right" },
            { "bSortable": false, "mDataProp": "SalonID",
                "mRender": function (data) {
                    var EditLinkText = '<a class="noExport" href="/salon/salon_view.php?salonid=' + data + '&custservmain=1"><img width="20px" title="View Salon Account" src="../img/edit.png"></a>';
                    return EditLinkText;
                } },

        ], 

        "dom": '<"clear">T<"clear"><"clear">lfrtip',
        "oTableTools": {
            "sSwfPath": "/swf/copy_csv_xls_pdf.swf",
            "aButtons": [
                {
                    "sExtends": "copy",
                    "oSelectorOpts": { filter: 'applied', order: 'current' },
                    "bShowAll": true
                },
                {
                    "sExtends": "xls",
                    "oSelectorOpts": { filter: 'applied', order: 'current' },
                    "sFileName": "SalonList_<?php echo date("Y-m-d_H-i")?>.xls",
                },
                {
                    "sExtends": "csv",
                    "oSelectorOpts": { filter: 'applied', order: 'current' },
                    "sFileName": "SalonList_<?php echo date("Y-m-d_H-i")?>.csv",
                },
                {
                    "sExtends": "print",
                    "oSelectorOpts": { filter: 'applied', order: 'current' },
                },
            ]
        }
    } );
} );

Viewing all articles
Browse latest Browse all 35607

Trending Articles