数据表上的多重过滤器选择不起作用

时间:2016-11-06 17:48:52

标签: javascript jquery datatable datatables

我目前正在使用jquery datatables插件。我想在其上使用“datatables multi filter select”并使用tabletools。 tabletools工作正常,但“datatables multi filter select”不起作用。该表未在列的页脚上显示下拉过滤器。

Js代码

var oTable=$('#table').DataTable({
        initComplete: function () {
            this.api().columns([0, 1, 9]).every( function () {
                var column = this;
                var select = $('<select><option value=""></option></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( '<option value="'+d+'">'+d+'</option>' )
                } );
            } );
        },
        dom: 'T<"clear">lfrtip',
        tableTools: {
            "sSwfPath": base_url + "assets/swf/copy_csv_xls_pdf.swf",
            "aButtons": [
                    "copy",
                    {
                        "sExtends": "csv",
                        "sFileName": "Report_"+date+".csv",
                        "sPdfOrientation": "landscape",
                        "oSelectorOpts": { filter: 'applied', order: 'current' }
                    },
                    {
                        "sExtends": "xls",
                        "sFileName": "Report_"+date+".xlsx",
                        "sPdfOrientation": "landscape",
                        "oSelectorOpts": { filter: 'applied', order: 'current' }
                    },
                    {
                        "sExtends": "pdf",
                        "sFileName": "Report_"+date+".pdf",
                        "sPdfMessage": "Summary Info",
                        "sPdfOrientation": "landscape",
                        "oSelectorOpts": { filter: 'applied', order: 'current' }
                    },
                    "print"
            ]
        }
    });

这里有什么问题?提前谢谢。

0 个答案:

没有答案