Filtering datatable at initialisation: filter row with empty column

Filtering datatable at initialisation: filter row with empty column

LECARROULECARROU Posts: 4Questions: 3Answers: 0

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

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    The searchCols docs has an example showing what you want to do. Instead of "bEscapeRegex": false the parameter should be regex: true to enable regex. You may also need to set smart option false.

    moreover, reading different forums and Datatable docs sometimes it is searchCols and other times it is aosearchCol

    The aosearchCol is the legacy form of the option while searchCols is the current (Datatables 1.10) version. The Conversion Guide provides the details.

    Kevin

This discussion has been closed.