Smart search for single integer

Smart search for single integer

kjkiddkjkidd Posts: 13Questions: 4Answers: 0

Hi,

my current search function looks like this:
$('#cat_id_search').on( 'keyup', function () { table .columns( 4 ) .search( this.value ) .draw(); update(); } );

The search term is entered into a text box. The issue is when the user enters "1", it returns results such as "1", "12", "120."

Are the any options/changes I can make so that only the "1's" are returned?
Thanks

This question has an accepted answers - jump to answer

Answers

  • kjkiddkjkidd Posts: 13Questions: 4Answers: 0
    edited June 2015

    So I believe I have the answer is to disable smart search and/or regex. This syntax provided is: column().search( input [, regex[ , smart[ , caseInsen ]]] )

    However I am still looking for an example on how to use this syntax to disable smart and/or regex. Anyone have any experience with this?

  • kjkiddkjkidd Posts: 13Questions: 4Answers: 0

    Did some more digging and it appears the syntax works like: column().search(input, false, false, true) to set regex and smart to false and caseInsen to true. However, after trying all the different combinations, it does not appear to be solving my original problem as hoped....

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Example available here.

    Allan

  • kjkiddkjkidd Posts: 13Questions: 4Answers: 0

    Looks like that will solve my issue. Thanks.

This discussion has been closed.