Why does 'numeric' type not affect search in 1.10?

Why does 'numeric' type not affect search in 1.10?

vcicmanecvcicmanec Posts: 6Questions: 2Answers: 0
edited July 2014 in Free community support

If I set a column to a 'numeric' type, I will, presumably, be searching for numbers. Treating numbers as strings makes very little sense, it's very rarely that search result for 25 would be correct if it returned 10025, 725698 and 25. Turning smart search off does nothing to eliminate this. Please consider changing the behaviour on 'numeric' to affect filtering mechanism as well.

Replies

  • allanallan Posts: 63,552Questions: 1Answers: 10,476 Site admin

    Thanks for the feedback. This would occur regardless of the data type since the search is string based and simply looks for the string anywhere in the data. Possibly the right thing to do here is to update the smart filtering to not match anywhere, but rather at the start of the string. I'll have a think about that, but I quite like that idea, since, as you say, it rather makes sense that you would start typing at the start of a phrase.

    Allan

  • vcicmanecvcicmanec Posts: 6Questions: 2Answers: 0

    Thanks for the reply. This would, however, not solve my issue either, as 25 and 2500 would be matched as well.
    I get that for some use cases this makes sense, but if i want to search for exact match on numbers, I have no option. Even wrapping the number in quotes like search('"' + 25 + '"', false, false) does not work as expected, not to mention it should not be necessary to do the wrapping in the first place.

  • allanallan Posts: 63,552Questions: 1Answers: 10,476 Site admin

    Filtering is a weak point in DataTables at the moment - easily its weakest point in fact and the next major version will be designed to address that, incoming exact matching, such as what you are looking for here (which will be an option to be enabled, since as you say, the current behaviour can be desirable in some cases).

    At the moment a regex is required to do what you are looking for.

    Allan

This discussion has been closed.