jquery datatable服务器端操作的问题
sj005 2016-02-06 10:01:16 程序从后台读取数据后分页、查找等功能都不能用了
代码如下
html
<table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="dyntable">
<colgroup>
<col class="con0" style="width: 4%" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
</colgroup>
<thead>
<tr>
<th class="head0">编号</th>
<th class="head1">用户名</th>
<th class="head0">性别</th>
<th class="head1">备注</th>
<th class="head0">分组</th>
<th class="head1">关注时间</th>
<th class="head0">最近访问</th>
</tr>
</thead>
<tfoot>
<tr>
<th class="head0">编号</th>
<th class="head1">用户名</th>
<th class="head0">性别</th>
<th class="head1">备注</th>
<th class="head0">分组</th>
<th class="head1">关注时间</th>
<th class="head0">最近访问</th>
</tr>
</tfoot>
<tbody>
</tbody>
</table>
js===============================================================
jQuery(document).ready(function() {
jQuery('#dyntable').dataTable({
"processing": true,
"serverSide": true,
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "所有"]],
"bLengthChange": true,
"ajax": "../../../data.php",
"bStateSave" :false,
"iDisplayLength" : 10,// 每页显示行数
"sPaginationType" : "full_numbers",
"oLanguage": {
"sUrl": "cn.txt"
},
"aoColumns": [
{ "data": "index" },
{ "data": "nickname" },
{ "data": "sex" },
{ "data": "remark" },
{ "data": "groupid" },
{ "data": "subscribe_time" },
{ "data": "recent" }
]
});
});
后台===============================================================
include("includes/json_encode_ex.php");
include("includes/database.php");
$db = new database();
$db->database_connection();
$sql = "SELECT * FROM T_WechatUserInfo";
$dd = $db->database_operation($sql);
$db->database_close();
$sum =count($dd);
$data=array(
"draw"=>2,
"iTotalRecords"=>$sum,
"iTotalDisplayRecords"=> 10,
"data"=>$dd,
);
$temp = new json_encode_ex();
echo $temp->JSON($data);
现在能把服务器端的数据全部显示到浏览器上,但是无法分页,我指定一页只能显示10条数据但还是会把所有数据全部显示出来