Search with command "change" ?

Search with command "change" ?

dudu_iosdudu_ios Posts: 1Questions: 1Answers: 0
edited June 2015 in Free community support

Hi guys, I have a question... i trying use the command "change" on selected for search on table, but i fail... i need some help.. if possible.

Here the datatable:

 var table = $('#sample_1').dataTable({
            "autoWidth": false,
            "processing": true,
            "bFilter": true,
            "serverSide": true,
            "ajax": "<?php echo HOME_URI; ?>/imobiliaria/serverprocessing?buscaStatus="+$('select#buscaStatus').val(),
            "aoColumnDefs": [{
                    "aTargets": [0]
                }],
            "aoColumnDefs": [
                {"bSortable": false, "aTargets": [0]}
            ],
                    "fnRowCallback": customFnRowCallback,
            "aaSorting": [[1, 'asc']],
            "oLanguage": {
                "sLengthMenu": "Exibir _MENU_ por página",
                "sZeroRecords": "Desculpe, nada encontrado",
                "sInfo": "Exibindo de _START_ a _END_ de _TOTAL_ registros",
                "sInfoEmpty": "Nenhum registro sendo exibido",
                "sInfoFiltered": "(filtrou-se a partir de _MAX_ registros)",
                "sSearch": "Busca:",
                "oPaginate": {
                    "sLast": "Last page",
                    "sNext": "Proxima",
                    "sPrevious": "Anterior"
                }
            },
            "aaSorting": [
                [1, 'asc']
            ],
                    "aLengthMenu": [
                        [5, 10, 15, 20, -1],
                        [5, 10, 15, 20, "Todos"] // change per page values here  
                    ],
            // set the initial value
            "iDisplayLength": 10
        });

Here the command "change":

    $('select#buscaStatus').change( function() {

           // alert("x: "+$('select#buscaStatus').val());

            $.ajax({
             "async": true,
             //"data": "&buscaStatus="+$('select#buscaStatus').val(),
             "type": "GET",
             "url": "<?php echo HOME_URI; ?>/imobiliaria/serverprocessing?buscaStatus="+$('select#buscaStatus').val(),
             "success": function(data){
                table.FnDraw();
             }
             });


    } );

I'm a starter... but i try do my best... please help :)... thank you...

Answers

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    Top FAQ. Use a delegated event :-)

    Allan

This discussion has been closed.