use*_*019 5 javascript bootstrap-table
我想更改使用表导出扩展时使用的文件名。我知道我可以使用 exportOptions 添加 {fileName:'custom_file_name'}。但我不知道把这个放在哪里。
我试过:
data-export-options="{fileName:'custom_file_name'}"
Run Code Online (Sandbox Code Playgroud)
我尝试添加为一种方法:
$('#table').bootstrapTable('exportOptions', {fileName: 'custom_file_name'})
Run Code Online (Sandbox Code Playgroud)
但后来我收到一个错误:未捕获的错误:未知方法:exportOptionsenter code here
我错过了什么?
小智 7
您可以添加以下内容作为 html 表属性:
data-export-options='{"fileName": "desired filename here"}'
Run Code Online (Sandbox Code Playgroud)
确保您有正确的引号,并且密钥是带有驼峰式命名法的文件名。
像这样使用:
$('#table').bootstrapTable({
exportOptions: {
fileName: 'custom_file_name'
}
});
Run Code Online (Sandbox Code Playgroud)
现在我们不支持通过数据属性,文档:http : //bootstrap-table.wenzhixin.net.cn/extensions/#table-export。
示例:http : //jsfiddle.net/wenyi/e3nk137y/3365/