1、DataTables的默認配置
$(document).ready(function() {$(‘#example').dataTable();} );
示例:http://www.guoxk.com/html/DataTables/Zero-configuration.html
2、DataTables的一些基礎屬性配置
“bPaginate”: true, //翻頁功能
“bLengthChange”: true, //改變每頁顯示數據數量
“bFilter”: true, //過濾功能
“bSort”: false, //排序功能
“bInfo”: true,//頁腳信息
“bAutoWidth”: true//自動寬度
示例:http://www.guoxk.com/html/DataTables/Feature-enablement.html
3、數據排序
$(document).ready(function() {$(‘#example').dataTable( {“aaSorting”: [[ 4, "desc" ]]} );} );
從第0列開始,以第4列倒序排列
示例:http://www.guoxk.com/html/DataTables/Sorting-data.html
4、多列排序
示例:http://www.guoxk.com/html/DataTables/Multi-column-sorting.html
5、隱藏某些列
$(document).ready(function() {$(‘#example').dataTable( {“aoColumnDefs”: [{ "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },{ “bVisible”: false, “aTargets”: [ 3 ] }] } );} );
示例:http://www.guoxk.com/html/DataTables/Hidden-columns.html
6、改變頁面上元素的位置
$(document).ready(function() {$(‘#example').dataTable( {“sDom”: ‘<”top”fli>rt<”bottom”p><”clear”>'} );} );//l- 每頁顯示數量//f 主站蜘蛛池模板: 曲沃县| 和平区| 乌恰县| 北宁市| 白山市| 娄底市| 雅安市| 峨眉山市| 宜君县| 和平县| 阿鲁科尔沁旗| 晋宁县| 雅江县| 右玉县| 思南县| 莆田市| 汉源县| 黔西县| 萨嘎县| 绥芬河市| 商丘市| 泗水县| 霍山县| 明星| 西畴县| 三明市| 岑巩县| 上思县| 温州市| 简阳市| 奎屯市| 仪征市| 鄢陵县| 始兴县| 大同市| 哈尔滨市| 军事| 墨竹工卡县| 宾川县| 忻城县| 洪泽县|