I'd like to ignore the Accent neutralise library for filters while keeping it for the search box

I'd like to ignore the Accent neutralise library for filters while keeping it for the search box

JiminyJiminy Posts: 13Questions: 4Answers: 0

Description of problem:
We are currently happily using the "Accent neutralise" library https://datatables.net/plug-ins/filtering/type-based/accent-neutralise but would love to be able to turn if off it for our custom filters (so that it runs just for the Search Box).

However when I study the jQuery.fn.DataTable.ext.type.search API I don't see a way to limit by type === 'filter' or type === 'search'. Is this possible in theory?

Thanks a million and Happy New Year!

Answers

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin

    Are you using a search plug-in for your custom search? If so, use the 4th parameter passed into it for the data rather than the second. The 4th parameter contains the original data, while the 2nd has the data passed through the type function.

    Allan

  • JiminyJiminy Posts: 13Questions: 4Answers: 0

    Hi Allan,

    thanks for the quick response. No, we're not using that search plug-in - I'm not sure of the reason why as it was another developer who wrote the code I'm looking at. We call column.search( val, true, false ).draw() on change of the filter. I guess there is no way to access that original data before calling column.search? It seems as though it would be a big job to rewrite our filters to use the search plug-ins.

    I'd be comfortable enough modifying the Accent Neutralise plugin if there was a way to access the type from within there. Do you think that would be feasible?

    cheers

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin

    Hi,

    Unfortunately, there is no way to do what you are looking for. DataTables' global search and the column search both use the data having been passed through any type plug-ins. They cannot be separated other than by modifying DataTables core.

    Allan

  • JiminyJiminy Posts: 13Questions: 4Answers: 0

    Thanks Allan, as always your work is appreciated!

Sign In or Register to comment.