Search with point doesn't work

Search with point doesn't work

DamianStolarekDamianStolarek Posts: 5Questions: 1Answers: 0

Hello,
after the succesfully migration to 2.14 I have found a problem with the search box and numbers with a point inside.
In the example:
">https://datatables.net/examples/advanced_init/enter_search.html

If I search for 1.200 I get 0 result. It schold be 1.
Can it be fixed for the next version?
Or can I configure the search options in an anoter way?
Best regards
Damian

Replies

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin

    Hi Damian,

    Are you seeing a salary with a number like that which you are expecting it to match? The number matching happens on the unformatted number, since I expect users to type "1200" rather than "1.200" or "1,200" (depending on where you are in the world).

    If you need search to work on both styles of number, you could use a custom rendering function that returns both styles for the filter data type (see orthogonal data).

    Allan

  • kthorngrenkthorngren Posts: 21,391Questions: 26Answers: 4,961

    That example does not have a point, ie ., in the data. It has a comma, for example: $1,200,000. Searching for 1,200 does work:

    Please provide a test case that shows the problem you are having.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • DamianStolarekDamianStolarek Posts: 5Questions: 1Answers: 0

    Hello and thanks for the fast answers.
    I have prepared an example:
    https://live.datatables.net/zoyiraqa/1/
    It's very easy :-)
    My problem is, to get the table filtered for the input values embedded in the column value.
    Does the example help to understand this?
    Best regards
    Damian

  • kthorngrenkthorngren Posts: 21,391Questions: 26Answers: 4,961
    edited August 30

    One option is to use Orthognal data, as Allan mentioned, for the filter type. Updated test case:
    https://live.datatables.net/zoyiraqa/2/edit

    It uses jQuery val() to get the input's value for filtering.

    Kevin

  • DamianStolarekDamianStolarek Posts: 5Questions: 1Answers: 0

    Hello Kevin,
    thank you very much it works perfect.
    I am using JQuery, so it'a a good solution.
    Have a nice day.
    Best regards
    Damian

Sign In or Register to comment.