Search in column doesn't work properly
Search in column doesn't work properly
Hey!
I'm quite new to data tables but I actually really like. Nevertheless, I already have my first problem.
Search the table actually works, but I don't want to get 10, 11, 100, ... if I search for 1.
I've already tried to do the trick using fnFilter() and creating an own text input field and search using table.search("^"+this.value+"$", true, false, true).draw();
. But none of my "solutions" did work. Using regular expressions in the "normal" search field which always gets created like ^#1$, doesn't work, because nothing gets shown. Although ^#1 works (but logically also shows 11, 12, 13, ...)
The column I'm talking about looks like this
1
2
3
4
...
In order to have the right sorting I use columnDefs: [
{ type: 'numeric', targets: 0 },
which works.
Do you have any idea of what I have done wrong?
Thank you in advance!
Answers
Problem solved using $('#id').DataTable().column(0).search("^"+this.value+"$", true, true).draw();