While Printing data table it's not able to get the data

While Printing data table it's not able to get the data

sultanmansoor40sultanmansoor40 Posts: 1Questions: 1Answers: 0
edited May 2020 in Free community support

Link to test case:

Debugger code (debug.datatables.net):

function getProductReport()
   {
      var product_id = $('#productSelect').find('option:selected').val();
      var Range = $('#ProductRange').val();
      var start = Range.slice(6,10)+'-'+Range.slice(0,2)+'-'+Range.slice(3,5);
      var end = Range.slice(19,23)+'-'+Range.slice(13,15)+'-'+Range.slice(16,18);
           // ajax set data to database
        $.ajax({
            url : "<?php echo site_url('reports/getProductReport')?>/",
            type: "POST",
            data: {product_id: product_id, start: start, end: end},
            success: function(data)
            {
              $('#statsSection').html(data);
              $('#stats').modal('show');
              var table = $('#Table').DataTable( {
                dom: 'T<"clear">lBfrtip',
                tableTools: {
                  'bProcessing'    : true
                },  
                buttons:  [ 
                  { 
                    extend: "print", 
                    exportOptions: { 
                      columns: ':visible'
                    }, 
                    // customize: filterStuff 
                  }, 
                ]
              });
            },
            error: function (jqXHR, textStatus, errorThrown)
            {
               alert("error");
            }
       });
   }

Description of problem:
The program is able to get the data in a new tab. but for the print, it prints an empty table to me.

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.