zoukankan      html  css  js  c++  java
  • datables

    https://editor.datatables.net/examples/styling/bootstrap.html

    https://datatables.net/forums/discussion/29319/new-rowsgroup-plugin-merge-cells-vertically-rowspan

    https://github.com/ashl1/datatables-rowsgroup/blob/master/example.html

    <html>
    <head>
    <link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css">

    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.js"></script>
    <script src="dataTables.rowsGroup.js"></script>
    </head>
    <body>
    <button id="update_btn">Manual remerge cells</button>
    <table id="example"></table>
    <table id="example1"></table>
    <script>
    $(function(){
    var data = [
    ['subgroupN', 'Group1', 'sub-subgroupN', 'ElementN', '2Element N'],
    ['subgroup1', 'Group2', 'sub-subgroup1', 'Element1', '2Element 1'],
    ['subgroup2', 'Group2', 'sub-subgroup1', 'Element1', '2Element 1'],
    ['subgroup2', 'Group2', 'sub-subgroup1', 'Element2', '2Element 2'],
    ['subgroup2', 'Group2', 'sub-subgroup2', 'Element3', '2Element 2'],
    ['subgroup2', 'Group2', 'sub-subgroup2', 'Element4', '2Element 4'],
    ['subgroup2', 'Group2', 'sub-subgroup2', 'Element2', '2Element 2'],
    ['subgroup3', 'Group1', 'sub-subgroup1', 'Element1', '2Element 1'],
    ['subgroup3', 'Group1', 'sub-subgroup1', 'Element1', '2Element 1'],
    ['subgroup2', 'Group2', 'sub-subgroup2', 'Element1', '2Element 1'],
    ['subgroup4', 'Group2', 'sub-subgroup2', 'Element1', '2Element 1'],
    ['subgroup4', 'Group2', 'sub-subgroup3', 'Element10', '2Element 17'],
    ['subgroup4', 'Group2', 'sub-subgroup3', 'Element231', '2Element 211'],

    ]
    var table = $('#example').DataTable({
    "iDisplayLength" : 8,
    columns: [
    {
    title: 'First group',
    },
    {
    name: 'second',
    title: 'Second group [order first]',
    },
    {
    title: 'Third group',
    },
    {
    title: 'Forth ungrouped',
    },
    {
    title: 'Fifth ungrouped',
    },
    ],
    data: data,
    /*lengthChange: false,
    searching: true,
    paging: true,
    order: [],*/
    rowsGroup: [// Always the array (!) of the column-selectors in specified order to which rows groupping is applied
    // (column-selector could be any of specified in https://datatables.net/reference/type/column-selector)
    0
    ],
    })
    /*table.draw(false);
    $('#update_btn').click(function(){
    table.rowsgroup.update();
    })*/

    var table1 = $('#example1').DataTable({
    "iDisplayLength" : 8,
    columns: [
    {
    title: 'First group',
    },
    {
    name: 'second',
    title: 'Second group [order first]',
    },
    {
    title: 'Third group',
    },
    {
    title: 'Forth ungrouped',
    },
    {
    title: 'Fifth ungrouped',
    },
    ],
    data: data,
    /*lengthChange: false,
    searching: true,
    paging: true,
    order: [],*/
    rowsGroup: [// Always the array (!) of the column-selectors in specified order to which rows groupping is applied
    // (column-selector could be any of specified in https://datatables.net/reference/type/column-selector)
    0
    ],
    })
    /*table1.draw(false);*/
    /*$('#update_btn').click(function(){
    table.rowsgroup.update();
    })*/


    });
    </script>
    </body>
    </html>

    var table1 = $('#example1').DataTable();

    var table2 = $('#example2').DataTable();
     
    $('#example tbody').on( 'click''img.icon-transfer'function () {
        var row = table1.row( $(this).parents('tr') );
        var rowNode = row.node();
        row.remove();
     
        table2
            .row.add( rowNode )
            .draw();
    } );
     
     
    var table = $('#example').DataTable();
     
    $('#example tbody').on( 'click''tr'function () {
        var d = table.row( this ).data();
         
        d.counter++;
     
        table
            .row( this )
            .data( d )
            .draw();
    } );
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    $(document).ready(function() {
        var table = $('#example').DataTable();
     
        $('#example tbody').on( 'click''tr'function () {
            if ( $(this).hasClass('selected') ) {
                $(this).removeClass('selected');
            }
            else {
                table.$('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        } );
     
        $('#button').click( function () {
            table.row('.selected').remove().draw( false );
        } );
    } );
     
     
     
     
     
    $(document).ready(function() {
        var t = $('#example').DataTable();
        var counter = 1;
     
        $('#addRow').on( 'click'function () {
            t.row.add( [
                counter +'.1',
                counter +'.2',
                counter +'.3',
                counter +'.4',
                counter +'.5'
            ] ).draw();
     
            counter++;
        } );
     
        // Automatically add a first row of data
        $('#addRow').click();
    } );
  • 相关阅读:
    去除Html标签
    asp.net弹出多个模态窗口
    window.returnValue的用法
    eTerm-用于报价的指令(GK状态码的使用)
    使用ffmpeg 操作音频文件前后部分静音移除.
    使用Visual Studio 2017开发python,并在iis上部署Python Django
    解决wampserver 服务无法启动
    网站优化记录-通过命令预编译Asp.net 网站,成功优化到毫秒级别。
    Scut游戏引擎改造兼容Codis。
    windows修改Host后未生效。
  • 原文地址:https://www.cnblogs.com/sunhai2016/p/5925523.html
Copyright © 2011-2022 走看看