简体   繁体   English

数据表中的按钮和分页显示不正确

[英]Buttons and pagination in datatables is showing incorrectly

I am using to use Datatables to display reports and records. 我正在使用数据表来显示报告和记录。 But I am having an issue where the file export buttons and the pagination at the bottom are only showing as links not as buttons. 但我遇到的问题是文件导出按钮和底部的分页只显示为链接而不是按钮。

Here is a screenshot of my screen 这是我的屏幕截图

在此输入图像描述

This is what I have loaded in my page 这是我在页面中加载的内容

<link href="/Vendor/bootstrap/v3.3.6/css/bootstrap.min.css" rel="stylesheet"/>

<script src="/Vendor/bootstrap/v3.3.6/js/bootstrap.min.js"></script>

<link href="/Vendor/datatables/v1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet"/>

<script src="/Vendor/datatables/v1.10.12/js/jquery.dataTables.min.js"></script>
<link href="/Vendor/datatables/v1.10.12/extensions/Buttons/css/buttons.bootstrap.min.css" rel="stylesheet"/>

<script src="/Vendor/datatables/v1.10.12/extensions/Buttons/js/dataTables.buttons.min.js"></script>
<script src="/Vendor/datatables/v1.10.12/extensions/Buttons/js/buttons.flash.min.js"></script>
<script src="/Vendor/datatables/v1.10.12/extensions/JSZip/jszip.min.js"></script>
<script src="/Vendor/datatables/v1.10.12/extensions/pdfmake/build/pdfmake.min.js"></script>
<script src="/Vendor/datatables/v1.10.12/extensions/pdfmake/build/vfs_fonts.js"></script>
<script src="/Vendor/datatables/v1.10.12/extensions/Buttons/js/buttons.html5.min.js"></script>
<script src="/Vendor/datatables/v1.10.12/extensions/Buttons/js/buttons.print.min.js"></script>

Note, that I only want to use the datatable with bootstrap style. 注意,我只想使用带引导样式的数据表。

Here is the code that I use to setup the datatable. 这是我用来设置数据表的代码。

        $('#reportTable').DataTable({
            dom: 'Bfrtip',
            buttons: [
                'copy', 'csv', 'excel', 'pdf', 'print'
            ],
            columns: [
                { data: 'Category', title: 'Category' },
                { data: 'Svp', title: 'SVP' },
                { data: 'Rvp', title: 'RVP' },
                { data: 'Division', title: 'Division' },
                { data: 'ContactType', title: 'Contact Type' },
                { data: 'TotalRecords', title: 'Total Records' },

            ]

        });

What am I missing here? 我在这里错过了什么? How can I fix this issue 我该如何解决这个问题

UPDATED 更新

I fixed the Export buttons but including the following file 我修复了导出按钮,但包括以下文件

Vendor/datatables/v1.10.12/extensions/Buttons/js/buttons.bootstrap.min.js

The only open issue now is the pages at the bottom 现在唯一开放的问题是底部的页面

You are missing the dataTables.bootstrap.min.js script file include. 您缺少dataTables.bootstrap.min.js脚本文件包含。 If you downloaded these files from the official DataTables download page and the file path of the other files can be extrapolated to this one, I'd take a look and see if it exists here: 如果您从官方DataTables 下载页面下载这些文件,并且可以将其他文件的文件路径外推到此文件路径,我会看看它是否存在于此处:

Vendor/datatables/v1.10.12/js/dataTables.boostrap.min.js

If it doesn't you may have to go back to the download page and make sure you get this script file. 如果没有,您可能必须返回下载页面并确保获得此脚本文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM