问题描述
我认为我正在按照documentation的说明进行操作,但出现此错误,并且无法找到解决方案
dataTables.buttons.min.js:16个未捕获的按钮:迭代次数过多
赔率:
<link rel="stylesheet" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.0.3/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.0.3/js/dataTables.buttons.min.js"></script>
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
@stack('scripts')
Yajrabox数据库模型方法:
public function html()
{
return $this->builder()
->setTableId('student-table')
->columns($this->getColumns())
->minifiedAjax()
->dom('Bfrtip')
->orderBy(1)
->buttons(
Button::make('cvs'),Button::make('excel')
);
}
protected function getColumns()
{
return [
Column::make('first_name'),Column::make('last_name'),];
}
解决方法
我第一次看到您写的是“ cvs”而不是“ csv”
您是否还在bootstrap.js文件中添加了数据表js / css? 如果是,那么您不需要所有这些额外的CDN脚本。
将您的->按钮呼叫更改为
->parameters([
'buttons' => ['csv'],]);