我的数据表中有37条列的大记录,并且打印页面中的数据崩溃

时间:2019-08-22 11:13:54

标签: javascript php jquery codeigniter datatable

我的数据表中有200列,其中大约有37条记录,在此,我有一个用于选择列的复选框,并且仅显示{{1} }列,但在打印页面中仅显示9到10列。 如何在打印页面中显示大列? enter image description here

查看:

37

控制器:

  <section class="content">
         <div class="table-responsive">
           <table id="loading_sheet_table" class="table table-bordered  table-sm" style=" overflow: auto;">
          </table>
       </div>
    </section>
  </form>
    <button id="print" name="print"  onclick="printContent('print_loading_sheet')" class="btn btn-block btn-outline-primary fa fa-newspaper-o col-10 offset-1" style="margin-top: 35px; margin-bottom: 25px;" data-clicked="unclicked"> Print Loading Sheet Report</button>
<script>
  $(document).ready(function($) {
    $.ajax({
               url :"<?php echo base_url(); ?>booking/report/loading_sheet/LoadingSheetController/loadingSheet",
               type: 'POST',               
               data: {
                ac_type:ac_type,
                Station:Station,
                MainStaion:MainStaion
               },
               dataType: "html",
               success: function(data){

                  $('#loading_sheet_table').html(data);

               },async:false,
               error:function(data){
                console.log('error occured during featch');
                /*alertify.error("error message"+data);*/
               }
           });
       });

  function printContent(e1) {
     event.preventDefault();
          var allVals = [];
        $('input[name=selectedrecord]:not(:checked').each(function() {
           allVals.push($(this).val());
           });
             allVals.forEach(function(i){
            $('tr').each(function(){
            $(this).find('td, th').eq(i-1).css({
                       display:'none'
           });
        });
      });
      $('input[name=selectedrecord]').css('visibility', 'hidden'); //hiding Check box on print page
      var restorepage     = document.innterHTML;
      var printContent    = document.getElementById(e1).innterHTML;
      document.innterHTML = printContent;
      window.print();
      document.location.href = "<?php echo base_url(); ?>"; 
   }
</script>

型号:

public function loadingSheet(){
         $ac_type  = $this->input->post('ac_type');
         $to       = $this->input->post('Station');
         $formData = array();
         $data     = array(
                   'ac_type'           => $ac_type,                
                   'station'           => $to,
              ); 
          $modResult = $this->sendValues->receivingSheetOfStationwise($data,$brnachId); 
          ?>

     <form role="form" id="bilties" name="bilties" method="post">
         <div class="row">
           <div class="table-responsive">
            <table id="loading_sheet_table" class="table table-bordered  table-sm" style=" overflow: auto;" >
                <thead>
                  <tr>
                  <th class="col1"><input   type="checkbox" name="selectedrecord" class="checkbox" value="1"><br>SR No</th>
                  <th class="col2"><input   type="checkbox" name="selectedrecord" class="checkbox" value="2"><br>Bilty Id</th>
                  <th class="col37"><input   type="checkbox" name="selectedrecord" class="checkbox" value="37"><br>Grand Total</th>//last record(37)
                 </tr>
                </thead>
                <tbody>
                <?php foreach($modResult as $bilty):?>
                  <tr>
                  <td><?php echo $bilty->id;?></td>
                  <td><?php echo $bilty->lr_no;?></td>
                  <td><?php echo $bilty->lr_grand_total;?></td>//last record(37)
                </tr>
                <?php endforeach; ?>              
                </tbody> 
            </table>
          </div>
        </div>
    </form>

我只有两个问题, 1)如何处理大型记录,例如我的数据表中的500条记录。 2)如何选择打印页面中的复选框后如何显示大列。

对于.Net Crystal中的报告,将使用我在Codeigniter中用于数据表报告的报告。

1 个答案:

答案 0 :(得分:1)

使用dompdf或tcpdf作为窗口打印将适用于小页面。

https://github.com/dompdf/dompdf

https://github.com/bcit-ci/CodeIgniter/wiki/TCPDF-Integration