Datatable Button Error: Uncaught Unknown button type: print
Datatable Button Error: Uncaught Unknown button type: print
数据表上的打印按钮有一个非常奇怪的问题,我找不到解决方案。
奇怪的是我已经在不同页面的数据表中使用了打印按钮。
目前我正在 rails 项目上进行 ruby,包括带有 jquery-datatables-rails gem 版本的数据表3.3.0.
此外,我通过引用资产管道中的文件路径(dataTables.buttons.min
和 buttons.datatables.min.css
)包含按钮的 CSS 和 JS 文件。
所有文件都已加载,没有任何问题或错误消息。
数据表的初始化也有效,但随后我添加了以下选项:
dom: 'Bfrtip'
buttons: [ 'print' ]
对于初始化程序,它会导致崩溃并显示以下错误消息:
Uncaught Unknown button type: print dataTables.buttons.min.js?body=1:18
很遗憾,我在互联网上找不到遇到同样问题的人。
我按照 https://datatables.net/extensions/buttons/ 上的说明进行操作,将这两个文件添加到我的页面。
此外,当我尝试使用 excel 按钮而不是 print 按钮时,没有出现错误消息,但仍然没有显示任何按钮。
div.dt-buttons
保持为空。
我该如何解决这个问题?
我认为您必须在页面中包含 print button extension。
来自the docs:
These buttons are not part of the core library, but rather are individual files that can be included as you require. For example you may with to provide HTML5 file export buttons but not Flash export buttons. This simply ensures that only the code you require is delivered to the end user.
您需要包含此文件:
//cdn.datatables.net/buttons/1.2.1/js/buttons.print.min.js
对于 Excel 等其他问题,您的案例中可能缺少相关资产文件。查看本例包含的JS文件列表,供参考
https://datatables.net/extensions/buttons/examples/initialisation/export.html
列表在示例的 Javascript 选项卡中给出。
数据表上的打印按钮有一个非常奇怪的问题,我找不到解决方案。
奇怪的是我已经在不同页面的数据表中使用了打印按钮。
目前我正在 rails 项目上进行 ruby,包括带有 jquery-datatables-rails gem 版本的数据表3.3.0.
此外,我通过引用资产管道中的文件路径(dataTables.buttons.min
和 buttons.datatables.min.css
)包含按钮的 CSS 和 JS 文件。
所有文件都已加载,没有任何问题或错误消息。 数据表的初始化也有效,但随后我添加了以下选项:
dom: 'Bfrtip'
buttons: [ 'print' ]
对于初始化程序,它会导致崩溃并显示以下错误消息:
Uncaught Unknown button type: print dataTables.buttons.min.js?body=1:18
很遗憾,我在互联网上找不到遇到同样问题的人。
我按照 https://datatables.net/extensions/buttons/ 上的说明进行操作,将这两个文件添加到我的页面。
此外,当我尝试使用 excel 按钮而不是 print 按钮时,没有出现错误消息,但仍然没有显示任何按钮。
div.dt-buttons
保持为空。
我该如何解决这个问题?
我认为您必须在页面中包含 print button extension。
来自the docs:
These buttons are not part of the core library, but rather are individual files that can be included as you require. For example you may with to provide HTML5 file export buttons but not Flash export buttons. This simply ensures that only the code you require is delivered to the end user.
您需要包含此文件:
//cdn.datatables.net/buttons/1.2.1/js/buttons.print.min.js
对于 Excel 等其他问题,您的案例中可能缺少相关资产文件。查看本例包含的JS文件列表,供参考
https://datatables.net/extensions/buttons/examples/initialisation/export.html
列表在示例的 Javascript 选项卡中给出。