Server Side Processing not honoring searchDelay
Server Side Processing not honoring searchDelay
My data code looks like this
$(document).ready(function () {
$('#myTable').DataTable({
fixedHeader: true,
ordering: false,
pageLength: 50,
searching: true,
searchDelay: 1000,
processing: true,
serverSide: true,
scrollY: calcDataTableHeight(),
scrollX: true,
ajax : {
url : '/my/url',
type : 'POST'
},
columns: [
{
// column defs here
],
fixedColumns: {
leftColumns: 1
}
});
});
However, a call to the server is made on every key stroke in the search box, not honoring the 1000ms delay that I have specified. What am I doing wrong?
Answers
here is the code properly formatted
Today I thought I was experiencing this too. I determined that searchDelay will search on the FIRST keystroke. But then it will wait Xms before checking to see if it needs to try to filter again.
I set mine to 2000ms and typed abababab repeatedly in the global search while watching the chrome network monitor page. I re-read the searchDelay documentation and this is how it is designed.
I was hoping for a setting that waited until no changes had occurred for Xms before filtering. Basically "Wait until they are finished typing."
Your code here looks very close to mine so i wonder if you were experiencing the same thing.
You aren't alone - it comes up fairly frequently. I made a mistake with that one and will probably change this in future.
Allan