zoukankan      html  css  js  c++  java
  • Bootstrap表格动态加载内容和排序功能

    安装Bootstrap

    我们可以到Bootstrap的官方网站下载Bootstrap的压缩版本,然后引入到我们的项目中,更多细节请参见Bootstrap安装教程,例如下面的代码:

    1
    2
    3
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>

    Table布局

    Bootstrap给table提供多个样式的类,你可按照自己的需要添加,例如我编写的表格:

    1
    2
    3
    <table class="table table-striped table-bordered" id="example">
        <tr><td></td></tr>
    </table>

    当然完整的表格肯定不止上面展示内容那么少,但是我们可以添加更多的内容。

    接下来是显示网格:定义为数据表控制元素的网格布局,此前我们曾用“span8”元素来表示半宽度的元素,但随着变化的12列在引导我们只需要改变使用“span6”。所以我们的数据表初始化看起来像:

    1
    2
    3
    4
    5
    $(document).ready(function() {
        $('#example').dataTable( {
            "sDom""<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>"
        } );
    } );

    我们还需要设置一个新的类,以数据表的形式包装元素使元素内联而不是作为一个块(表过滤输入长度选择器是通过这。为此我们只是扩展为DataTable“swrapper”类的选项:

    1
    2
    3
    $.extend( $.fn.dataTableExt.oStdClasses, {
        "sWrapper""dataTables_wrapper form-inline"
    } );
     
     
     

    http://www.jq22.com/jquery-info11321

    http://www.jq22.com/yanshi11321

  • 相关阅读:
    fastText源码分析
    excel文件使用html导出
    oracle中对字符串进行分割,并反回随机段
    oracle锁表进行关闭
    .net中MVC Webapi多参数调用控制器方法
    C#线程调用带参数的方法,给控件赋值
    C#post调用接口并上传文件
    C#调用GPG命令进行加密解密文件操作
    C#中图片转换为Base64编码,Base64编码转换为图片
    GPG加密windows中使用
  • 原文地址:https://www.cnblogs.com/apolloren/p/12116181.html
Copyright © 2011-2022 走看看