Individual column searching

Individual column searching

CountLessQCountLessQ Posts: 33Questions: 9Answers: 0

I followed this tutorial
https://datatables.net/examples/api/multi_filter.html
I get this error:
Uncaught TypeError: otable.columns(...).every is not a function
at HTMLDocument.<anonymous> (Index:166)
at mightThrow (jquery-3.3.1.js:3534)
at process (jquery-3.3.1.js:3602)
This is my code:

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css">

<!-- jQuery -->

<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.3.1.js"></script>

<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.5/js/jquery.dataTables.js">
</script>

@section scripts{

    <script>



        $(document).ready(function () {
            // Setup - add a text input to each footer cell
            $('#item tfoot th').each(function () {

                $(this).html('<input type="text" style="color: black" placeholder="(All)" />');
            });

            // DataTable
            var otable = $('#item').DataTable({
                "paging": false,
                "searching": false,
                 "bInfo": false,
                "bLengthChange": false,
                "pageLength": 200

            });

            // Apply the search
            otable.columns().every(function () {

                var that = this;
                $('input', this.footer()).on('keyup change', function () {
                    if (that.search() !== this.value) {
                        that
                            .search(this.value)
                            .draw();
                    }
                });
            });

        });
    </script>

}

This question has accepted answers - jump to:

Answers

This discussion has been closed.