我有一个Excel数据表,但是它没有显示在页面上。
我的代码:
<style>
.buttons-excel{
margin-left: 23px;
}
</style>
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/datatables/dataTables.bootstrap4.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<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 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>
<table id="all_sub" class="table table-bordered table-striped" style="width: 100%;" >
<thead class="thead-light">
<tr>
<th>Subscriber Name</th>
<th>Course Name</th>
</tr>
</thead>
<tbody>
<?php foreach($allsubscriber as $allsub):?>
<tr>
<td><?php echo $allsub->user_firstname;?></td>
<td><?php echo $allsub->course_title;?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<script>
$(document).ready(function() {
$('#all_sub').DataTable( {
"pageLength": 50,dom: 'lBfrtip',buttons: [
{ extend: 'excel',text: 'export to excel <i class="fa fa-file-excel-o" aria-hidden="true"></i>' }
]
} );
} );
</script>
我认为代码中的一切都很好,但是我不知道代码中哪里有错。 在不知道会发生什么之前,它一直在工作。