jQuery表格插件datatables用法总结(下)
2017-03-13 10:56
537 查看
使用总结:
要导入CSS 和 JS
<table class="table table-striped" id="giatable">
<thead>
<tr>
<th>GIA</th>
<th>...</th>
</tr>
</thead>
<tbody>
<tr>
<td>...</td>
</tr>
</tbody>
</table>
3. 使用datatable
<script>
$(document).ready(function () {
$('#giatable').dataTable({
"aaSorting": [
[0, ""] //默认以第一列升序排列,"" 可以关掉排序
],
"aoColumnDefs": [
{"bSearchable": true, "bVisible": true, "bSortable": true, "aTargets": [0, 1, 2, 3, 4, 7, 8]}, //第0 1 2 3 4 7 8 可以搜索可排序
{"bSortable": false, "aTargets": [9, 10]} //第9 10 不可排序
],
"bAutoWidth": false, //自适应宽度
// "aaSorting": [[1, "asc"]],
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "正在加载中......",
"sLengthMenu": "每页显示 _MENU_ 条记录",
"sZeroRecords": "对不起,查询不到相关数据!",
"sEmptyTable": "表中无数据存在!",
"sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",
"sInfoFiltered": "数据表中共为 _MAX_ 条记录",
"sSearch": "当前结果内搜索",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上一页",
"sNext": "下一页",
"sLast": "末页"
}
}
})
});
</script>
要导入CSS 和 JS
<link href="/static/css/bootstrap.min.css" rel="stylesheet"> <link href="/static/css/jquery.dataTables.min.css" rel="stylesheet"> <script src="/static/js/jquery.min.js"></script> <script src="/static/js/bootstrap.min.js"></script> <script src="/static/js/jquery.dataTables.min.js"></script>
2. 定义table
<table class="table table-striped" id="giatable">
<thead>
<tr>
<th>GIA</th>
<th>...</th>
</tr>
</thead>
<tbody>
<tr>
<td>...</td>
</tr>
</tbody>
</table>
3. 使用datatable
<script>
$(document).ready(function () {
$('#giatable').dataTable({
"aaSorting": [
[0, ""] //默认以第一列升序排列,"" 可以关掉排序
],
"aoColumnDefs": [
{"bSearchable": true, "bVisible": true, "bSortable": true, "aTargets": [0, 1, 2, 3, 4, 7, 8]}, //第0 1 2 3 4 7 8 可以搜索可排序
{"bSortable": false, "aTargets": [9, 10]} //第9 10 不可排序
],
"bAutoWidth": false, //自适应宽度
// "aaSorting": [[1, "asc"]],
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "正在加载中......",
"sLengthMenu": "每页显示 _MENU_ 条记录",
"sZeroRecords": "对不起,查询不到相关数据!",
"sEmptyTable": "表中无数据存在!",
"sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",
"sInfoFiltered": "数据表中共为 _MAX_ 条记录",
"sSearch": "当前结果内搜索",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上一页",
"sNext": "下一页",
"sLast": "末页"
}
}
})
});
</script>
相关文章推荐
- jQuery表格插件datatables用法总结
- jQuery表格插件datatables用法总结(上)
- jQuery表格插件datatables用法总结
- jQuery表格插件datatables用法总结(中)
- [JQuery,前端]jQuery表格插件datatables用法汇总
- jQuery的表格插件datatables学习总结
- jQuery表格插件datatables用法汇总
- [JQuery,前端]jQuery表格插件datatables用法详解
- jQuery表格插件datatables用法详解
- jQuery表格插件datatables用法详解
- (原)jq表格插件dataTables的一些总结(一)
- JQuery表格插件之Datatables
- jQuery的表格插件datatables
- JQuery.dataTables表格插件添加跳转到指定页
- 利用Jquery插件 DataTables 表格转PDF CVS EXCEL PRINT 等
- JQuery.dataTables免费开源的数据表格插件
- jquery表格插件datatables应用实例
- Datatables快速入门开发--一款好用的JQuery表格插件
- jQuery.datatables.js插件用法及api实例详解
- easyui-layout和easyui-combobox和jQuery表格控件flexigrid用法总结