Custom filter not working if search string contains space

Custom filter not working if search string contains space

domenico_neridomenico_neri Posts: 1Questions: 1Answers: 0

I've a custom filter, bound to a dropdownlist where the user can select one element to filter the records.

The function to apply the filter is this:

        function filterCategoria() {
            var filter = $('#categoria_filter').val();
            if (filter != null) {
                $('#dtRicette').DataTable().column(2).search(
                    filter
                ).draw();
            } else {
                $('#dtRicette').DataTable().search('').draw();
            }
        }

Everything is working fine, only if the search string doesn't containt any space. If contain space the result of the filter is empty.

How can I fix it?

Thanks.

Answers

This discussion has been closed.