【问题标题】:Preferable way of datatables 1.10 column specific filtering?datatables 1.10 列特定过滤的首选方式?
【发布时间】:2016-10-25 07:48:33
【问题描述】:

我最近才开始使用 jquery DataTables。对于列过滤,我正在研究原始的“columnfilter”插件,尽管它似乎没有最近的更新(除了许多开发人员的一些补丁),也没有适应 1.10 版。对 1.10 版进行列特定过滤的最佳方法是什么? (客户端和服务器端)

【问题讨论】:

    标签: datatable datatables datatables-1.10


    【解决方案1】:

    我只用过客户端和这段代码:

            $("#browse_1_div thead input").keyup( function () {
                /* Filter on the column (the index) of this element */
                oTable.fnFilter( this.value, $("thead input").index(this) );
            } );
    
            /*
             * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
             * the footer
             */
            $("#browse_1_div thead input").each( function (i) {
                asInitVals[i] = this.value;
            } );
    
            $("#browse_1_div thead input").focus( function () {
                if ( this.className == "search_init_1" )
                {
                    this.className = "";
                    this.value = "";
                }
            } );
    
            $("#browse_1_div thead input").blur( function (i) {
                if ( this.value == "" )
                {
                    this.className = "search_init_1";
                    this.value = asInitVals[$("#browse_1_div thead input").index(this)];
                }
            } );
    

    【讨论】:

    • 如果我将此与 columnFilter 插件进行比较,这似乎是一项非常艰巨的工作......
    • 它是,这是相当古老的代码和平,但它仍然可以正常工作。
    猜你喜欢
    • 2011-12-22
    • 1970-01-01
    • 2021-10-31
    • 1970-01-01
    • 2014-08-15
    • 2018-03-13
    • 2015-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多