【发布时间】:2016-04-20 06:33:19
【问题描述】:
在解决了另一个让读取数据库的 php 代码正常工作的问题后,发现这是我自己的错误,即服务器文档根目录中没有 html,我很犹豫要不要问这个问题,但这里是:
我正在显示包含的 jQuery 模块和 css 模块的标题列表。我得到了前 10 行数据,这 10 行是可排序的,但只有那 10 行。我无法显示分页按钮,也无法显示其他行,即使我将数字设置为 25,也只有 10 显示.
<title>My Library</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css"/>
<LINK REL="stylesheet" HREF="_css/jquery.dataTables_themeroller.css" />
<LINK REL="stylesheet" HREF="_css/home.css" id="styleid"/>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" class="init">
$(document).ready(function() {
$('#books').DataTable({
processing: true,
bStateSave: true,
ajax: {
url: "./get_books.php",
dataSrc: "data"
},
columns: [
{ data: "id" },
{ data: "author" },
{ data: "title" },
{ data: "genre" },
{ data: "location" },
{ data: "notes" }
]
});
$(document).on('click','#books tbody tr',function() {
var row = $(this).closest("tr");
//alert("You clicked: "+$(row).find("td:nth-child(6)").text());
editBook($(row).find("td:nth-child(1)").text(),$(row).find("td:nth-child(2)").text(),$(row).find("td:nth-child(3)").text(),$(row).find("td:nth-child(4)").text(), $(row).find("td:nth-child(5)").text(), $(row).find("td:nth-child(6)").text());
});
});
</script>
home.css 设置一些默认颜色。我正在使用 easyui 弹出输入和编辑表单。这似乎奏效了。
【问题讨论】:
标签: jquery html css pagination datatables