javascript - Bootstrap表导出数据问题

标签 javascript python html twitter-bootstrap jinja2

我有一个使用 Jinja2 模板用 Python Flask 编写的 Web 应用程序。我正在尝试添加 Bootstrap 表以从表中导出数据。因此,我下载了 CSS 和 Javascript 文件并将其复制到适当的文件夹中,并如下引用它们。

<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-table.min.css') }}">
<script type="text/javascript" src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/bootstrap-table.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/bootstrap-table-export.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/tableexport.js') }}"></script>
<script>$("div.navbar-fixed-top").autoHidingNavbar();</script>
<link href="http://getbootstrap.com/examples/justified-nav/justified-nav.css" rel="stylesheet">
<link rel="stylesheet" href="http://cdn.bokeh.org/bokeh/release/bokeh-0.9.2.min.css" type="text/css" />
<script type="text/javascript" src="http://cdn.bokeh**strong text**.org/bokeh/release/bokeh-0.9.2.min.js"></script>

为了创建表,我有这部分代码:

<table class="table table-bordered table-hover" id="pageTables" data-toggle="table" data-show-columns="true" data-search="true" data-show-refresh="true" data-show-toggle="true" data-show-export="true" data-pagination="true" data-click-to-select="true" data-toolbar="#toolbar">
    <thead>
        <tr>
            <th data-field="E">E</th>
            <th data-field="bthrs">Base </th>
            <th data-field="mag">Mag</th>
            <th data-field="ht">Ho (secs)</th>
            <th data-field="dt">De(secs)</th>
        </tr>
    </thead> 
....

<script>
var $table = $('#table');
$(function () {
    $('#toolbar').find('select').change(function () {
        $table.bootstrapTable('refreshOptions', {
            exportDataType: $(this).val()
        });
    });
})

它创建了我的表,但导出数据不起作用。你能帮我一下吗?

最佳答案

这可能意味着您的 bootstrap.table.min.css 位置有问题。 如果您只有此错误,请检查包含“bootstrap.min.css”的文件夹是否也包含“bootstrap.table.min.css”。 如果不存在,请尝试从以下位置下载:http://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.css P.S:在你的代码中,你似乎有 bootstrap.table.min.css,不是 bootstrap-table.min.css。 (有一个点而不是“-”)

关于javascript - Bootstrap表导出数据问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33677752/

相关文章:

javascript - 在 html 中单击按钮获取日历并用所选日期填充文本字段

javascript - 1 :m (using belongsTo and hasMany). 的问题结果不反射(reflect)提议的模型

javascript - 如何从 bash 控制台运行 Jasmine 测试?

c++ - python 结构体中的 vector

python - python中的数据框和系列创建excel列

c# - 在 C# 中将 &#____ 转换为\u____ 吗?

html - Form 和 Div 元素之间的默认 CSS 设计差异

javascript - 响应拦截器数据不完整

javascript - 在 HTML5/Javascript 移动应用程序中下载 PDF 文件

python - 如何根据另一个列表制作 Python 列表