官方:http://www.datatables.club
相关文档:http://www.tuicool.com/articles/NBBnum
中文语言包:https://datatables.net/plug-ins/i18n/Chinese
语言包:https://datatables.net/plug-ins/i18n
layer相关插件:http://layer.layui.com/api.html
http://www.tuicool.com/articles/NBBnum
API查看: http://www.datatables.club/reference/option/
使用:
- 引入资源
编辑 删除
2. 初始化
$(document).ready(function(){
$('#myTable').DataTable();
});
服务器端返回参数格式:
{
"draw": 2,
"recordsTotal": 11,
"recordsFiltered": 11,
"data": [
{
"id": 1,
"firstName": "Troy",
"lastName": "Young"
},
{
"id": 2,
"firstName": "Alice",
"lastName": "LL"
},
{
"id": 3,
"firstName": "Larry",
"lastName": "Bird"
}
// ......
]
}
测试:
data插件使用
序号
名称
年龄
操作
1
曹阳
12
2
mark
34
3
ytest
52
测试:
where('updated_at', '>' , 'start');
// $query->where('updated_at', '<' , 'end');
// $query->limt(2)->offset(0);
// $query->get();
// whereIn()->get()->each(function($Item)){}
echo $data;
?>