Uncaught TypeError: this.movie.setSheetName is not a function - Angularjs Datatable
Uncaught TypeError: this.movie.setSheetName is not a function - Angularjs Datatable
谁能告诉我为什么会出现此错误。
Uncaught TypeError: this.movie.setSheetName is not a function
使用此处提到的 Angularjs 数据表中的按钮时
https://l-lin.github.io/angular-datatables/#/withButtons
这是代码
$rootScope.dtOptions = DTOptionsBuilder.newOptions()
.withPaginationType('full_numbers')
.withDisplayLength(10)
.withDOM('frtip')
.withBootstrap()
.withBootstrapOptions({
TableTools: {
classes: {
container: 'btn-group',
buttons: {
normal: 'btn btn-danger'
}
}
},
ColVis: {
classes: {
masterButton: 'btn btn-primary'
}
},
pagination: {
classes: {
ul: 'pagination pagination-sm'
}
}
})
.withOption('bLengthChange', false).withButtons([
'copy',
'print',
'excel'
]);
您需要安装 jszip。将这一行添加到您的 bower.json
dependencies
部分(如果您使用的是凉亭)
"dependencies": {
...
"jszip": "2.6.0"
}
和运行一个bower update
。或者使用 npm
:
npm install jszip@2.6.0
请务必明确使用 2.6.0
(或更低)。 dataTables 与最新的 3.0.0
.
不兼容
更新;设置文件名:
.withButtons([
{
extend : 'excel'
filename: 'download',
},
...
])
这将生成一个名为 download.xlsx
的文件
谁能告诉我为什么会出现此错误。
Uncaught TypeError: this.movie.setSheetName is not a function
使用此处提到的 Angularjs 数据表中的按钮时
https://l-lin.github.io/angular-datatables/#/withButtons
这是代码
$rootScope.dtOptions = DTOptionsBuilder.newOptions()
.withPaginationType('full_numbers')
.withDisplayLength(10)
.withDOM('frtip')
.withBootstrap()
.withBootstrapOptions({
TableTools: {
classes: {
container: 'btn-group',
buttons: {
normal: 'btn btn-danger'
}
}
},
ColVis: {
classes: {
masterButton: 'btn btn-primary'
}
},
pagination: {
classes: {
ul: 'pagination pagination-sm'
}
}
})
.withOption('bLengthChange', false).withButtons([
'copy',
'print',
'excel'
]);
您需要安装 jszip。将这一行添加到您的 bower.json
dependencies
部分(如果您使用的是凉亭)
"dependencies": {
...
"jszip": "2.6.0"
}
和运行一个bower update
。或者使用 npm
:
npm install jszip@2.6.0
请务必明确使用 2.6.0
(或更低)。 dataTables 与最新的 3.0.0
.
更新;设置文件名:
.withButtons([
{
extend : 'excel'
filename: 'download',
},
...
])
这将生成一个名为 download.xlsx