Javascript 我的页面中有数据表,数据表排序不起作用

Javascript 我的页面中有数据表,数据表排序不起作用,javascript,php,jquery,codeigniter,datatable,Javascript,Php,Jquery,Codeigniter,Datatable,我的页面中有数据表,我想在表中添加排序,但它不起作用 视图: 不要发布控制器代码,因为这是客户端问题。发布一组客户端代码(使用最终的HTML!)。您还应该检查您的标签;你把东西包括两次。另外,您是否在浏览器控制台中收到错误消息?@ChrisG it give consoleUncaught TypeError:无法读取undefinedOk的属性'aDataSort',因此我们返回到您创建的位置。@Chris G这不是我的答案请勿发布控制器代码,因为这是客户端问题。发布一组客户端代码(使用最终的

我的页面中有数据表,我想在表中添加排序,但它不起作用

视图:


不要发布控制器代码,因为这是客户端问题。发布一组客户端代码(使用最终的HTML!)。您还应该检查您的
标签;你把东西包括两次。另外,您是否在浏览器控制台中收到错误消息?@ChrisG it give console
Uncaught TypeError:无法读取undefined
Ok的属性'aDataSort',因此我们返回到您创建的位置。@Chris G这不是我的答案请勿发布控制器代码,因为这是客户端问题。发布一组客户端代码(使用最终的HTML!)。您还应该检查您的
标签;你把东西包括两次。另外,您是否在浏览器控制台中收到错误消息?@ChrisG it give console
Uncaught TypeError:无法读取未定义的属性“aDataSort”
Ok,因此我们回到您创建的问题上。@Chris G这不是我的答案
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/datatables/dataTables.bootstrap4.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/custom/css/custom_style.css">

<style>
   .highlight { background-color: #1DA5FF; color:#fff; }
    th,
    td {
        white-space: nowrap;
    }

    div.dataTables_wrapper {
        direction: rtl;
    }

    div.dataTables_wrapper {
        width: 1000px;
        margin: 0 auto;
        font-family: Vazir;
        font-size: 10px;
    }

    th {
        min-width: 80px;
        height: 32px;
        border: 1px solid #222;
        white-space: nowrap;
    }

    td {

        min-width: 80px;
        height: 32px;
        border: 1px solid #222;
        white-space: nowrap;
        text-align: center;
    }
</style>

    <style type="text/css" media="screen">
  td{
    padding: 0;
  }  
  </style>

<form role="form" id="print_booking_register" method="POST" enctype="multipart/form-data">
    <section class="content">
       <div class="row">
         <div class="table-responsive">
          <table id="booking_register_table" class="table table-bordered  table-sm" style=" overflow: auto;"> </table>
         </div>
     </div>
  </section>
</form>
 <button id="print" name="print"  onclick="printContent('print_booking_register')" 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 Booking Register</button>


<!-- DataTables -->
<script src="<?php echo base_url(); ?>assets/plugins/datatables/jquery.dataTables.js"></script>
<script src="<?php echo base_url(); ?>assets/plugins/datatables/dataTables.bootstrap4.js"></script>
<script href=" https://code.jquery.com/jquery-3.3.1.js"></script>
<script src=" <?php echo base_url(); ?>assets/plugins/datatables/jquery.dataTables.min.js"></script>
<script href=" https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<script href=" https://cdn.datatables.net/fixedcolumns/3.2.6/js/dataTables.fixedColumns.min.js"></script>


<script>

   $(document).ready(function() {
    $('#booking_register_table').dataTable({
       order: [[ 3, 'desc' ], [ 0, 'asc' ]]
      });

    });
 </script>

<script>
     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'

                 });
        });
      });

      $('#print').css('visibility', 'hidden'); //hiding print button on print page
      $('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(); ?>"; 
      location.href="<?php echo base_url(); ?>booking/report/booking_register/BookingRegisterController/bookingRegister", 'refresh';
       }

</script>

</body> 
</html> 
$modelResult = $this->reportModel->bookingRegisterReportByLrno($data);
?>
  <table id="bilty_table" class="table table-bordered table-striped table-sm" style=" overflow: auto;">
            <thead>
             <tr>
              <th class="col2"><input   type="checkbox" name="selectedrecord" value="2">LR No</th>
              <th class="col3"><input   type="checkbox" name="selectedrecord" value="3">Consignor Name</th>
            </tr>
          </thead>
          <tbody>
             <?php foreach($modelResult as $bilty){?>
            <tr>
              <td><?php echo $counter;?></td>
              <td><?php echo $bilty->lr_no;?></td>
              <td><?php echo $bilty->consignor;?></td>
            </tr>
            <?php }?>
        </tbody>
    </table>