Bug in fnFilter for Regexp global search.
Bug in fnFilter for Regexp global search.
Let's say I create a simple dataTable
[code]
var oTable = $('#table1').dataTable({
'aaData': [
['John', 'ABC', '$120000'], ['Doe', 'XYZ', '$200000'], ['Alan', 'PQR', '$150000'], ['Jim', 'DEF', '$300000']
],
'aoColumns': [
{'sTitle': 'Name', 'bRegex': true},
{'sTitle': 'Company', 'bRegex': true},
{'sTitle': 'Salary', 'bRegex': true}
]
})
[/code]
If we try to do a global regex search using
[code]
var pattern = $('#searchBox').val() /*Regular expression example Apple|Banana to search for Apple and Banana and both*/
$('#seachBox').keyup(function(e)){
if(e.keyCode==13){
oTable.fnFilter(pattern, null, true); /*This will work only if both the values are in the column 0*/
}
}
[/code]
Try searching for "John|Doe". It works. Now try for "ABC|XYZ". It will only give results containing "ABC"
This seems to be a bug with the code.
[code]
var oTable = $('#table1').dataTable({
'aaData': [
['John', 'ABC', '$120000'], ['Doe', 'XYZ', '$200000'], ['Alan', 'PQR', '$150000'], ['Jim', 'DEF', '$300000']
],
'aoColumns': [
{'sTitle': 'Name', 'bRegex': true},
{'sTitle': 'Company', 'bRegex': true},
{'sTitle': 'Salary', 'bRegex': true}
]
})
[/code]
If we try to do a global regex search using
[code]
var pattern = $('#searchBox').val() /*Regular expression example Apple|Banana to search for Apple and Banana and both*/
$('#seachBox').keyup(function(e)){
if(e.keyCode==13){
oTable.fnFilter(pattern, null, true); /*This will work only if both the values are in the column 0*/
}
}
[/code]
Try searching for "John|Doe". It works. Now try for "ABC|XYZ". It will only give results containing "ABC"
This seems to be a bug with the code.
This discussion has been closed.