How to apply filter to specific datatable

后端 未结 6 1370
既然无缘
既然无缘 2020-12-08 21:03

Is it possible to apply a certain filter to only one datatable? I have the following filter function that I am applying on document ready, I don\'t know if this is proper pr

6条回答
  •  时光说笑
    2020-12-08 21:34

    This is what we do:

                var temporarilySetFilterFunctions = $.fn.dataTableExt.afnFiltering;
                $.fn.dataTableExt.afnFiltering = [function (settings, data, index) {
                    // our filter function
                } ];
    
                this._table.dataTable().fnDraw(); // filter!
    
                $.fn.dataTableExt.afnFiltering = temporarilySetFilterFunctions;
    

    Basically store the existing filters in a TEMP variable and then revert it after we are done. Weird design descion on Allan's part to implement it like this. Ugly hack, but it works.

提交回复
热议问题