我有一个html文件,可以使用flask应用程序来渲染我的表格。它工作得很好,我想添加一些使用数据表的定制。
我真的不确定在jQuery部分的什么地方添加自定义。我的代码在html文件中有它,但是当我运行它时,我看不到定制工作。它应该是我的项目文件夹中的静态/js/jquery.js文件吗?我已经下载了数据表,但我看不到结果。
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
$(document).ready(function () {
$('#queues').dataTable();
});
</script>
<script
src="https://code.jquery.com/jquery-1.11.1.min.js"></script> //
JQuery Reference
<script
src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js">
</script>
<script
src="https://cdn.datatables.net/plug-
ins/9dcbecd42ad/integration/jqueryui/dataTables.jqueryui.js">
</script>
<link rel="stylesheet"
href="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-
ui.css">
<link rel="stylesheet"
href="https://cdn.datatables.net/plugins/9dcbecd42ad/integration/
jqueryui/dataTables.jqueryui.css">
<style type="text/css">
body {
background: seashell;
color: black;
}
div.container {
max-width: 500px;
margin: 100px auto;
border: 20px solid white;
padding: 10px;
text-align: center;
}
h4 {
text-transform: uppercase;
}
</style>
<title>{{ title }} - Queues</title>
</head>
<body>
<h2>Page for Queues display </h2>
<p style="color:blue;">Queues information</p>
<table border="1">
<th style="text-align:left;">Job</th>
<th style="text-align:left;">Team</th>
<th style="text-align:left;">Problem</th>
<th style="text-align:left;">CPU</th>
<th style="text-align:left;">Memory</th>
{% for row in data%}
<tr>
<td>{{ row[0] }}</td> <td>{{ row[1] }}</td> <td>{{ row[2] }}</td> <td>{{ row[3] }}</td> <td>{{ row[4] }}</td>
</tr>
{% endfor %}
</table>我得到了正确显示数据的表,但没有自定义。我遵循了本例中的说明:https://www.codeproject.com/Tips/844403/%2FTips%2F844403%2FjQuery-Datatables-For-Beginners
发布于 2019-01-01 05:41:37
我以前发现,在使用数据表时,如果不在表中包含<tbody>和<thead>标记,表将不会显示为datable。这些将显示在您发送的链接中,但不会显示在您的代码中。
https://stackoverflow.com/questions/53991294
复制相似问题