【发布时间】:2019-09-11 10:26:01
【问题描述】:
我正在尝试通过添加 excel 按钮
buttons: [
'excel'
]
但它不起作用
我的代码:
<div class="row">
<div class="col-9">
<div class="card">
<div class="card-body">
<h4 class="mt-0 mb-3 header-title">Subscribers</h4>
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table id="all_sub" class="table">
<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>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready( function () {
$('#all_sub').DataTable();
buttons: [
'excel'
]
});
</script>
在上面的代码中,我尝试添加 excel 但它不起作用。 我不知道我的代码哪里错了。
【问题讨论】:
-
你添加datatable js库了吗?
标签: javascript php jquery codeigniter datatable