Exact column matching problem
Exact column matching problem
danstaunton
Posts: 6Questions: 0Answers: 0
Hi,
I am trying to filter my results by values in column 0. For your information column 0 holds a unique call reference number in my table.
$(document).ready(function() {
oTable = $('.dataTable').dataTable();
oTable.fnFilter(100, 0, true, false, false);
} );
The above should only display results with a reference number of 100. However it displays results like 100, eg "100" , "10000" "1000001"
I have also tried
oTable.fnFilter("^"+100+"$", 0, true, false, false);
however this returns "No matching records found"
Thanks in advance for your help.
Dan
I am trying to filter my results by values in column 0. For your information column 0 holds a unique call reference number in my table.
$(document).ready(function() {
oTable = $('.dataTable').dataTable();
oTable.fnFilter(100, 0, true, false, false);
} );
The above should only display results with a reference number of 100. However it displays results like 100, eg "100" , "10000" "1000001"
I have also tried
oTable.fnFilter("^"+100+"$", 0, true, false, false);
however this returns "No matching records found"
Thanks in advance for your help.
Dan
This discussion has been closed.
Replies
As you have indicated regular expression matching is required for an exact match. This example shows it working: http://live.datatables.net/IMOz/1/ .
Can you please link to a test case showing the error (as noted in the forum rules).
Allan
Apologies for not the posting a test case.
Thanks for posting your example however I still cannot see where I am going wrong.
Here is my test example. It should be filtering column 0 which has a value of 2.
http://79.174.222.26:8080/dashboard/portal.php
Ah. That's the information I was missing.
In that case its up to your `calldetails.php` script, whatever is in there, to do the filtering. You will probably want to not use a regular expression (for performance) but instead manipulate the WHERE condition to do exact matching (assuming that at the moment it is not).
Allan
I changed the where clause for individual column filtering
[code]$sWhere .= $aColumns[$i]." like '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' "; [/code]
to
[code]$sWhere .= $aColumns[$i]." = '".mysql_real_escape_string($_GET['sSearch_'.$i])."' "; [/code]