Filtering datatable at initialisation: filter row with empty column
Filtering datatable at initialisation: filter row with empty column
Hi
Error messages shown:
No error
Description of problem:
I use Datatable and want to filter (not show) rows with empty column
I have a tsimple table with 2 rows :
- first row : fourth column is empty -> this line mut be filtered (hide)
- second column : fourth colum contain a link -> this line must be shown
I try to use aoSearchCols option using a regex but the 2 lines are filtered
I don't understand what is doing bEscapeRegex but doesn't not impact result if I set true or even if I remove
I have tested my regex expression and it seems to works
moreover, reading different forums and Datatable docs sometimes it is searchCols and other times it is aosearchCol
"aoSearchCols": [ // filtre sur les lignes pour lesquelles la collone 'Actions' dispose d'un lien
null,
null,
null,
{ "sSearch": "^[A-Z]", "bEscapeRegex": false }
]
Answers
The
searchCols
docs has an example showing what you want to do. Instead of"bEscapeRegex": false
the parameter should beregex: true
to enable regex. You may also need to setsmart
option false.The
aosearchCol
is the legacy form of the option whilesearchCols
is the current (Datatables 1.10) version. The Conversion Guide provides the details.Kevin