How to add filter functions with ES6 ?

How to add filter functions with ES6 ?

JohndodevJohndodev Posts: 5Questions: 3Answers: 0
edited May 2023 in Free community support

Hello,

According to https://datatables.net/examples/plug-ins/range_filtering.html we should add filtering functions like that : $.fn.dataTable.ext.search.push(...).
Problem is, when we initialize table with imports and new Datatable(...), $.fn.dataTable.ext.search doesn't exist.

Is there a new more modern way to do this now ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,084Questions: 1Answers: 10,180 Site admin
    Answer ✓

    Use:

    DataTable.ext.search.push(...)
    

    I've got a change for that example already committed, but I'm working on related changes before pushing it out.

    The key to remember is that $.fn.dataTable is the same as DataTable (assuming you do import DataTabe from 'datatables.net' or are just including the UMD file on your page).

    Allan

  • JohndodevJohndodev Posts: 5Questions: 3Answers: 0

    Ahhh I tried with the new instance but not the "module" himself. Thanks.

Sign In or Register to comment.