column(column name).search doesn't work

column(column name).search doesn't work

YannYann Posts: 5Questions: 2Answers: 0
edited May 2015 in Free community support

Hi.
I use Datatables for 2 days, and I meet my first real problem.

Here is my code :

var table_client = $('#table_client').DataTable({
            "language": {"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json"},
            "bPaginate": true,
            "bLengthChange": false,
            "bFilter": false,
            "bSort": true,
            "bInfo": true,
            "bAutoWidth": true,
            "iDisplayLength": 5,
            "lengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
            "sAjaxSource": 'phplib/loadClients.php',
            "sAjaxDataProp": "",
            "columns": [
                { "data": "id_client", "visible": false, "searchable" : false },
                { "data": "nom" },
                { "data": "ville" },
                { "data": "nb_presta" },
                { "data": "nb_salarie" }
            ]
        });

        //Recherche de la valeur saisie dans les champs de recherche
        $('#search').on('keyup change',function(){
            //alert(this.value);
            table_client.columns('nom').search(this.value).draw();
        });

Problem: nothing is found, and table is not redrawn.

Thanks for any kind of help.

Answers

  • allanallan Posts: 64,020Questions: 1Answers: 10,555 Site admin

    Can you link to the page, as per the forum rules please? That way we can debug the page and try to offer some advice.

    Allan

  • allanallan Posts: 64,020Questions: 1Answers: 10,555 Site admin

    Oh - also - you have disabled filtering ("bFilter": false,) which is why the search won't work. Remove that option if you want to be table to search / filter!

    Allan

  • YannYann Posts: 5Questions: 2Answers: 0

    Hi Allan, and thanks for your answers.
    I've found my crazy mistake, disabling filtering. Since I enabled it, everything works fine. Thanks.

This discussion has been closed.