• datatables使用


    //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 - 过滤输入
    //t - 表单Table
    //i - 信息
    //p - 翻页
    //r - pRocessing
    //< and > - div elements
    //<"class" and > - div with a class
    //Examples: <"wrapper"flipt>, <lf<t>ip>
    //示例:http://www.guoxk.com/html/DataTables/DOM-positioning.html
    //7、状态保存,使用了翻页或者改变了每页显示数据数量,会保存在cookie中,下回访问时会显示上一次关闭页面时的内容。
    $(document).ready(function() {
    $('#example').dataTable( {
    "bStateSave"true
    } );
    } );
    //示例:http://www.guoxk.com/html/DataTables/State-saving.html
    //8、显示数字的翻页样式
    $(document).ready(function() {
    $('#example').dataTable( {
    "sPaginationType""full_numbers"
    } );
    } );
    //示例:http://www.guoxk.com/html/DataTables/Alternative-pagination-styles.html
    //9、水平限制宽度
    $(document).ready(function() {
    $('#example').dataTable( {
    "sScrollX""100%",
    "sScrollXInner""110%",
    "bScrollCollapse"true
    } );
    } );
    //示例:http://www.guoxk.com/html/DataTables/Horizontal.html
    //10、垂直限制高度
    //示例:http://www.guoxk.com/html/DataTables/Vertical.html
    //11、水平和垂直两个方向共同限制
    //示例:http://www.guoxk.com/html/DataTables/HorizontalVerticalBoth.html
    //12、改变语言
    $(document).ready(function() {
    $('#example').dataTable( {
    "oLanguage": {
    "sLengthMenu""每页显示 _MENU_ 条记录",
    "sZeroRecords""抱歉, 没有找到",
    "sInfo""从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
    "sInfoEmpty""没有数据",
    "sInfoFiltered""(从 _MAX_ 条数据中检索)",
    "oPaginate": {
    "sFirst""首页",
    "sPrevious""前一页",
    "sNext""后一页",
    "sLast""尾页"
    },
    "sZeroRecords""没有检索到数据",
    "sProcessing""<img src='./loading.gif' />"
    }
    } );
    } );
    //示例:http://www.guoxk.com/html/DataTables/Change-language-information.html
    //13、click事件
    //示例:http://www.guoxk.com/html/DataTables/event-click.html
    //14/配合使用tooltip插件
    //示例:http://www.guoxk.com/html/DataTables/tooltip.html
    //15、定义每页显示数据数量
    $(document).ready(function() {
    $('#example').dataTable( {
    "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
    } );
    } );
    //示例:http://www.guoxk.com/html/DataTables/length_menu.html
  • 相关阅读:
    84最佳买卖股票时机含冷冻期(309)
    83 不同路径 II(63)
    82同路径(62)
    模块与包
    名称空间与作用域
    函数的参数
    函数对象
    函数继续学习中
    python学习day3-上午
    第一个完成程序:通过文件实现注册登录
  • 原文地址:https://www.cnblogs.com/zhangym/p/6093858.html
Copyright © 2020-2023  润新知