0
votes

I am using datatable server side script for getting data from table.I have 500 000 of record in database table.I want to export all 500,000 records using datatable tableTool plugin.right now I am able to export current page data with pagination limit.

var otable = $('#datatable_fixed_column').DataTable({           
        "bProcessing": true,
        "serverSide":true,          
                 "ajax": "index.php?c=datadownload&m=getalldata",
        "sDom": ""+
                "<'dt-toolbar'<'col-xs-12 col-sm-6'l><'col-sm-6 col-xs-6 hidden-xs'T>>"+
                "t"+
                "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-sm-6 col-xs-12'p>>",

        "oTableTools": {
             "aButtons": [
                {
                    "sExtends": "copy",
                    "mColumns": [0,1,2],
                    "oSelectorOpts": {filter: 'applied', order: "current"}
                },             

               {
            "sExtends": "csv",
                    "mColumns": [0,1,2],
                    "sTitle":"Category Data",
                    "oSelectorOpts": {filter: 'applied'},

                },

                {
                    "sExtends": "xls",
                    "mColumns": [0,1,2],
                    "sFileName":"*.xls",
                    "sTitle":"Category Data",
                    "oSelectorOpts": {filter: 'applied', order: "current" }
                },             

             ],
            "sSwfPath": baseUrl+"public/plugins/datatables/swf/copy_csv_xls_pdf.swf"
        },
        "aoColumns":[


            {
                "mData":"data1",
                "sName":"data1",
                "sTitle":"data1"

            },
            {
                "mData":"data2",
                "sName":"data2",
                "sTitle":"data2"
            },
                 {
                        "mData":"data3",
                        "sName":"data3",
                        "sTitle":"data3"
                 }





        ],
        "autoWidth" : true

    });     
2

2 Answers

0
votes

http://legacy.datatables.net/ref

//How many results to show per page, set this to enough to show them all then export 

"aLengthMenu": [[10, 25, 50, 100, 500, 1000], [10, 25, 50, 100, 500, 1000]]
0
votes

You can use lengthMenu appropriately.

To allow infinite number of records Limit -1 or Limit null can be specified using length menu.

"lengthMenu" : [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]

or

"lengthMenu" : [[10, 25, 50, 100, null], [10, 25, 50, 100, "All"]]

Another way is to use highest possible int/bigint value.

"lengthMenu" : [[10, 25, 50, 100, 4294967295], [10, 25, 50, 100, "All"]]