javascript - Jquery Datatable search -


i've created datatable using jquery datatable.

 $('#mytable').datatable({     "pagingtype": "simple_numbers",     "blengthchange": false,     "idisplaylength": 10,     "aasorting": [[0, 'asc']],     "processing": true,     "serverside": true,     "ajax": $('#mytable').data('source'),     "aocolumndefs": [         {'bsortable': false, 'atargets': [3, 4]}     ] }); 

but how can search on data displayed on table?

var datatable = $('#mytable').datatable();    $('#yourinputfieldid').on('input keyup paste', function () {     datatable.fnfilter(this.value);   }); 

// prevent submit on enter need prevent default behaviour of enter key on keydown event

$('#yourinputfieldid').keydown(function (event) {     if (event.keycode === 13) {       event.preventdefault();       return false;     }   }); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -