Smart search for single integer
Smart search for single integer
kjkidd
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
This discussion has been closed.
Answers
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?
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....
Example available here.
Allan
Looks like that will solve my issue. Thanks.