📜  如何过滤隐藏列数据表 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:02.587000             🧑  作者: Mango

代码示例1
Plain text12345678910111213141516171819202122232425262728293031323334353637383940414243444546$(document).ready( function () {    $('#example').DataTable(    {                 responsive: true,        scrollY:'40vh',        scrollCollapse: true,        columnDefs: [        { targets: [0, 3, 4, 5, 7, 8, 9, 11, 12], visible: true},        { targets: '_all', visible: false },                 { width: "40%", targets: [5] }    ],                          "order": [[ 0, "asc" ]],        rowGroup: {                         enable: true,            dataSrc: 1,        },         initComplete: function () {            this.api().columns([1]).every(function () {                var column = this;                var select = $('')                    .appendTo( $(column.footer()).empty() )                    .on( 'change', function () {                        var val = $.fn.dataTable.util.escapeRegex(                            $(this).val()                        );                          column                            .search( val ? '^'+val+'$' : '', true, false )                            .draw();                    } );                  column.data().unique().sort().each( function ( d, j ) {                    select.append( '' )                } );            } );        }}         );     } );