Regex search and Natural Sort not working together
Regex search and Natural Sort not working together
Hello,
When i use https://datatables.net/plug-ins/sorting/natural, it breaks regex search. This problem was raised in this discussion here - https://datatables.net/forums/discussion/27125 but it was closed.
The example here replicates this issue
live.datatables.net/lupufuci/2/
`// Works as expected. Search for "^A"
var table = $('#example').DataTable({
'search' : {'regex': true}
});
If you now change the columns to use natural sort, the above will not work.
// Does not work expected. Search for "^A"
var table = $('#example').DataTable({
'search' : {'regex': true},
'columnDefs' : [{ type: 'natural', targets: '_all' }
]
});
In the original discussion there was a 'fix' by adding fn.dataTable.ext.type.search.natural to js. I may be adding it to the wrong place, i added that code to the natural.js but no luck. Can anyone shed some light
Answers
ah, actually my use case was using natural-ci as the columndefs, if i use natural, then the fix does indeed work
Right, i ended up just overriding natural to be case insensitive and that works for my use case
Nice, glad it's all working,
Colin