0

Thanks to Stryner for his code How to disable a search/filter on a specific column on a datatable?

which is exactly what I was looking for.

BUT, if bottom TH cells do display the inputs where needed, on blur/change/keyup, nothing happends...

Console : Undefined is not a function - corresponding to " oTable.columns().eq( 0 ).each( function ( colIdx ) {"

Can you help me to solve this, please ?

Thank u :))

$('#datos tfoot th').not(":eq(0),:eq(3),:eq(5),:eq(6)") //Exclude columns 0, 3, 5 and 6
                     .each( function ()
                      {
                      var title = $('#example thead th').eq( $(this).index() ).text();
                      $(this).html( '<input type="text" placeholder="Rechercher" />' );
                     });
   var oTable = $('#datos').dataTable();

   oTable.columns().eq( 0 ).each( function ( colIdx ) {
    if (colIdx == 0 || colIdx == 3 || colIdx == 5 || colIdx == 6) return; //Do not add event handlers for these columns

    $( 'input', table.column( colIdx ).footer() ).on( 'keyup blur change', function () {  oTable
                                                                                          .column( colIdx )
                                                                                          .search( this.value )
                                                                                          .draw();
                                                                                        });
}); 

My server-side script is the same as this one at the bottom of the page daniweb.com/web-development/php/threads/467455/convert-datatables-to-server-side-processing

Thanks

Community
  • 1
  • 1
  • This seems to work fine. Check it here : http://jsfiddle.net/yn88cv2q. You might want to check your jQuery version or your html table to be set correctly. – despina Feb 28 '15 at 17:33
  • 1
    It doesn't work at all. The bottom search inputs are displayed correctly, but no filtering is done when I type something in. Moreover in the console I read UNDEFINED IS NOT A FUNCTION, and I am not good-enough in jquery to solve it by myself.... I don"t know. Please Help Me :)) – user2828574 Feb 28 '15 at 18:46
  • Have a check this link [DataTable (Server side) Custom Column Search](http://coderexample.com/datatable-custom-column-search/) in datatable 1.10 version – Arka Mar 01 '15 at 18:55
  • Arka : Thanks for the link. I've followed the code given in the first example, and I'm stuck once again : either with $query .= JOIN or on my column "PostCode City". I get `{"draw":1,"recordsTotal":16,"recordsFiltered":0,"data":[]}` ... Thanks, I'm on datables since a week yet, trying so many codes, formulations, and I'm getting crazy/depressed/sick not to be able to make it work – user2828574 Mar 02 '15 at 19:44

1 Answers1

0

Please try this for your keyup event and let me know if it works. I've used this long time ago so can't be sure if it works for you, but maybe it helps:

$("tfoot input").keyup( function () {
        /* Filter on the column (the index) of this element */
        oTable.fnFilter( this.value, $("tfoot input").index(this) );
    } );
despina
  • 437
  • 3
  • 13