Datatable filter ignore comma and dot and white space

Datatable filter ignore comma and dot and white space

ipsmartipsmart Posts: 3Questions: 1Answers: 1

I need to search a client side table with or without comma, dot or space

for instance i have a column amount (with values 1,200.00 EUR) .
The user should be able to search 1200 or 120000EUR and get record with 1,200.00 EUR as search result.
(and searching with 1,200 would be still valid)

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921
    Answer ✓

    I would look at creating a search plugin for this. A good example to start with might be the phoneNumber plugin found here.

    Kevin

  • ipsmartipsmart Posts: 3Questions: 1Answers: 1
    edited November 2019

    Hi,
    I have not got the actual solution for that.
    plugin

    <script src="~/Scripts/datatables.min.js"></script>
    <script src="~/Content/DataTables-1.10.16/js/filtering/type-based/html.js"></script>
    <script src="~/Content/DataTables-1.10.16/js/filtering/type-based/phoneNumber.js"></script>
    

    Code:

    var table = $('#helpmnu').DataTable({ "columnDefs": [ { type: "html", target: 0 } ] });

    Please help me

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921

    Did you update the phoneNumber plugin to remove the characters you want? I pointed you to it as an example for you to modify to fit your needs.

    Doesn't look like you applied the phoneNumber type to any of your columns.

    Please post a test case with an example of your data and what you have done with the plugin. We can then take a look to help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.