How do JQuery DataTable Search Works?

How do JQuery DataTable Search Works?

kurtzkurtz Posts: 2Questions: 1Answers: 0
edited April 2015 in Free community support

Hi,

I am looking for explanation of how the search works.. I have this table when the search is performed it doesn't show the expected result.

here is the example http://jsfiddle.net/yesterdaysfoe/b57foa72/1/

when you try to search "store a"
my expected result should be "No matching records found"
but it display 1 row which is the "Store 1, Branch b"

Is this a bug or Does it really what it should be?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,032Questions: 1Answers: 10,555 Site admin
    Answer ✓

    No bug - you are searching for store and a, both of which are found in the string "Store 1, Branch b".

    If you want to limit the searching to matching at the start of a word only, you would need to use a custom regular expression.

    Allan

  • kurtzkurtz Posts: 2Questions: 1Answers: 0

    After some reading, I now barely understand how it works, and yes, you were right about breaking my search input word by word because as default search.smart is enable.

    I just set search.smart option to false to meet my expected result.

    $('#example').dataTable( {
    "search": {
    "smart": false
    }
    } );

    link: https://datatables.net/reference/option/search.smart

    Thanks.

This discussion has been closed.