Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CanadianDeer's avatar

Search DataTables

Hello,

When I want to perform a search in my table with DataTable, it works perfectly, except from the moment when I want to reset my settings for the language and for CSV / Excel export (so the comment part).

Can you help me on this?

Thank you

$('#liste-intervention tfoot th').each(function() {
            let title = $(this).text();
            $(this).html('<input type="text" class="form-control" placeholder="'+ title +'" />');
        });

        let table = $('#liste-intervention').DataTable({
                        // 'language': {
                        //     'url': '//cdn.datatables.net/plug-ins/1.10.20/i18n/French.json'
                        // },
                        // dom: 'Bfrtip',
                        // buttons: [
                        //     'csv', 'excel'
                        // ]
                    });

        table.columns().every(function() {
            let that = this;

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

Please or to participate in this conversation.