title: issue with downloading all redords from server side yajra datatable
body: <p>I want to download all records from server side yajra datatable as pdf and excel format and not only particular page for that I have make below code</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var table = $('.dataTables-example').DataTable({
      "aaSorting": [],
      destroy: true,
      pageLength: 25,
      responsive: true,
      // processing: true,
      serverSide: true,
      dom: '&lt;"html5buttons"B&gt;lTftigp', 
      buttons: 
      [
          { 
              extend: 'copy',
              footer: true
          },
          {
              extend: 'csv',
              footer: true
          },
          {
              extend: 'excel', title: 'Customer Sales Rep Sales Totals',
              footer: true,
              action: newExportAction
          },
          { 
              extend: 'pdfHtml5',  title: 'Customer Sales Rep Sales Totals', orientation: 'landscape',
              exportOptions: 
              {
                  columns: ':visible',
                  search: 'applied',
                  order: 'applied',
                  modifier: 
                  {
                      pageMargins: [ 0, 0, 0, 0 ], // try #3 setting margins
                      margin: [ 10,0 ], // try #4 setting margins
                      alignment: 'center'
                  }, 
                  body: 
                  {
                      margin:[10,0],
                      pageMargins: [ 0, 0, 0, 0 ],
                      alignment: 'center'
                  }, 
                  columns: [0,1,2,3,4,5,6,7] //column id visible in PDF    
              },
              customize: function (doc) 
              {                       
                  //doc.content.splice(0,1);
                  doc.content[1].table.widths = ['10%','10%','10%','10%','15%','15%','15%','15%'];
                  doc.content[1].borders = ['2px solid'];
  
                  /* doc.content[1].table.widths =
                                  Array(doc.content[1].table.body[1].length + 1).join('*').split('');*/
  
                  doc.content.splice(0,0);
  
                  //Create a date string that we use in the footer. Format is dd-mm-yyyy
                  var now = new Date();
                  var jsDate = now.getDate()+'-'+(now.getMonth()+1)+'-'+now.getFullYear();
                  
                  var logo = 'logo.png';
                  
                  doc.pageMargins = [20,60,20,30];
  
                  // Set the font size fot the entire document
                  doc.defaultStyle.fontSize = 8;
                  /*doc.defaultStyle.width=100;*/
                  // Set the fontsize for the table header
                  doc.styles.tableHeader.fontSize = 10;
                  doc.styles.tableHeader.alignment = 'left';
                  
                  doc['header']=(function() {
                      return {
                          columns: [
                              {
                                  image: logo,
                                  width: 80
                              },
                          ],
                          margin: 20,
                          width:100
                      }
                  });
              
                  doc['footer']=(function(page, pages) {
                      return {
                          columns: [
                              {
                                  alignment: 'left',
                                  text: ['Created on: ', { text: jsDate.toString() }]
                              },
                              {
                                  alignment: 'right',
                                  text: ['page ', { text: page.toString() },  ' of ', { text: pages.toString() }]
                              }
                          ],
                          margin: 20
                      }
                  });
              
                  var objLayout = {};
                  objLayout['hLineWidth'] = function(i) { return .100; };
                  objLayout['vLineWidth'] = function(i) { return .100; };
                  objLayout['hLineColor'] = function(i) { return '#aaa'; };
                  objLayout['vLineColor'] = function(i) { return '#aaa'; };
                  objLayout['paddingLeft'] = function(i) { return 0; };
                  objLayout['paddingRight'] = function(i) { return 0; };
                  objLayout['alignment'] = function(i) { return 'center'; };
                  doc.content[0].layout = objLayout;
              }
          },
          {
              extend: 'print', text : 'Print Preview',
              exportOptions: 
              {
                  columns: ':not(.no-export)'
              },
              customize: function (win)
              {
                  $(win.document.body).addClass('white-bg');
                  $(win.document.body).css('font-size', '10px');
          
                  $(win.document.body).find('table')
                          .addClass('compact')
                          .css('font-size', 'inherit');
  
                  $(win.document.body).find('image')
                          .addClass('img')
                          .css('height', '50');                                               
              }
          }
      ],
      ajax: {
          url:'{{ route("admin.ajaxCustomerSalesRepTotal") }}',
          method:'post',
          data: { srch_start_date: srch_start_date, srch_end_date : srch_end_date },
      },
      columns : [
          {data : 'total_sales', name : 'total_sales'},
          {data : 'total_orders', name : 'total_orders'},
          {data : 'account_number', name : 'account_number'},
          {data : 'account_suffix', name : 'account_suffix'},
          {data : 'sales_rep_id', name : 'sales_rep_id'},
          {data : 'sales_last_name', name : 'sales_last_name'},
          {data : 'sales_first_name', name : 'sales_first_name'},
          {data : 'sales_state_name', name : 'sales_state_name'},
      ],
  });</code></pre>
  </div>
  </div>
  </p>
  <p>and as per <a href="https://stackoverflow.com/questions/32692618/how-to-export-all-rows-from-datatables-using-ajax">This</a> link I have use below code to implement this in excel format</p>
  <pre><code>var oldExportAction = function (self, e, dt, button, config) {
      if (button[0].className.indexOf('buttons-excel') &gt;= 0) {
          if ($.fn.dataTable.ext.buttons.excelHtml5.available(dt, config)) {
              $.fn.dataTable.ext.buttons.excelHtml5.action.call(self, e, dt, button, config);
          }
          else {
              $.fn.dataTable.ext.buttons.excelFlash.action.call(self, e, dt, button, config);
          }
      } else if (button[0].className.indexOf('buttons-print') &gt;= 0) {
          $.fn.dataTable.ext.buttons.print.action(e, dt, button, config);
      }
  };
  
  var newExportAction = function (e, dt, button, config) {
      var self = this;
      var oldStart = dt.settings()[0]._iDisplayStart;
  
      dt.one('preXhr', function (e, s, data) {
          // Just this once, load all data from the server...
          data.start = 0;
          data.length = 2147483647;
  
          dt.one('preDraw', function (e, settings) {
              // Call the original action function 
              oldExportAction(self, e, dt, button, config);
  
              dt.one('preXhr', function (e, s, data) {
                  // DataTables thinks the first item displayed is index 0, but we're not drawing that.
                  // Set the property to what it was before exporting.
                  settings._iDisplayStart = oldStart;
                  data.start = oldStart;
              });
  
              // Reload the grid with the original page. Otherwise, API functions like table.cell(this) don't work properly.
              setTimeout(dt.ajax.reload, 0);
  
              // Prevent rendering of the full data to the DOM
              return false;
          });
      });
  
      // Requery the server with the new one-time export settings
      dt.ajax.reload();
  };
  </code></pre>
  <p>but I am failed to serch this type function for PDF can anybody help me in this</p>