5

I'm trying to implement a simple custom search on a column. This is well documented at https://datatables.net/examples/plug-ins/range_filtering.html. However my (so far) only problem is accessing the $.fn.dataTable.ext.search array, to add and later remove my custom search function.

What is the path for this array, when going through angular-datatables?

Thanks in advance for your help.

 this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => {

      dtInstance. <-- what goes here?
 });
Michael Sørensen
  • 395
  • 1
  • 3
  • 14
  • `$.fn.dataTable.ext.search` is a "global" list not specific to tables or dataTable instances. You should be able to use it right away (ad4 use $ internally). Perhaps you have [forgotten to declare the $ alias](https://stackoverflow.com/questions/43934727/how-to-use-jquery-plugin-with-angular-4) but `jQuery.fn.dataTable.ext.search.push()` etc should work anywhere. – davidkonrad Oct 17 '17 at 12:03
  • It claims that dataTable doesn't exist. Then when I change that to DataTable, it claims that ext doesn't exist. – Michael Sørensen Oct 19 '17 at 12:37
  • It is almost waste of reps. Please show your code, and please elaborate more than "*what goes here?*" – davidkonrad Oct 23 '17 at 08:55

1 Answers1

3

Was solved by the developer at https://github.com/l-lin/angular-datatables/issues/1111

It was because the typings were not complete, when using typescript in angular. Correct reference is $.fn['dataTable'].ext.search

Michael Sørensen
  • 395
  • 1
  • 3
  • 14