目前我产生基本表与PHP获得通过AJAX数据表内容
<table id="list" class="display">
<thead>
<tr id="hdr">
<th><input type="checkbox" id="check_all"/> ID</th>
<th>Ref. No</th>
<th>Color</th>
<th>Size</th>
<th>Quantity</th>
<th>Stack NO</th>
<th>Price</th>
<th>Add Date</th>
</tr>
</thead>
<tbody>
<?php
$result = $db->query("SELECT * FROM `items` ORDER BY id DESC");
if ($result->num_rows > 0) {
while ($row = $result->fetch_object()) {
echo '<tr url="?page=item&id=' . $row->id . '">
<td class="item_id"><input type="checkbox" name="checkbox[]" method="post" value="' . $row->id . '" class="checkbox"/> ' . $row->id . '</td>
<td> ' . $row->refno . '</td>
<td style="text-align:center">' . $row->color . '</td>
<td style="text-align:center">' . $row->size . '</td>
<td style="text-align:center" id="qt">' . trim($row->qt) . '</td>
<td style="text-align:center">' . $row->stackno . '</td>
<td style="text-align:center">' . $row->price . '</td>
<td>' . date('d.m.Y', strtotime($row->add_date)) . '</td>
</tr>';
}
}
?>
</tbody>
</table>
然后将数据表到这个像
oTable= $('#list').dataTable({
"bJQueryUI": true,
"iDisplayLength": 25,
"aaSorting": [],
"aoColumns": [
{
"bSortable": false
},
null, null, null,null,null, null, null
]
}).columnFilter({
sPlaceHolder: "head:before",
aoColumns: [ null, null, null,null,null, null, null,
{
type: "date-range"
}
]
});
有很大的问题:
目前我表格大约有2000行。生成和加载整个表格需要很长时间。 (首先它会生成applieas数据表)如何修改此脚本以通过ajax逐页获取内容?
同意;所有的例子都在那里。我的第一个DataTables项目使用服务器端,我从来没有想过它隐藏;我期待它,它就在那里:http://datatables.net/usage/server-side – 2012-03-04 01:31:58