{hero}

searchDelay

Since: DataTables 1.10.3

Set a throttle frequency for searching.

Description

The built-in DataTables global search (by default at the top right of every DataTable) will instantly search the table on every keypress when in client-side processing mode and reduce the search call frequency automatically to 400mS when in server-side processing mode. This call frequency (throttling) can be controlled using the searchDelay parameter for both client-side and server-side processing.

Being able to control the call frequency has a number of uses:

  • Older browsers and slower computers can have their processing load reduced by reducing the search frequency
  • Fewer table redraws while searching can be less distracting for the user
  • Reduce the load on the server when using server-side processing by making fewer calls
  • Conversely, you can speed up the search when using server-side processing by reducing the default of 400mS to instant (0).

As with many other parts of DataTables, it is up to yourself how you configure it to suit your needs!

The value given for searchDelay is in milliseconds (mS).

Please note that this option effects only the built in global search box that DataTables provides. It does not effect the search() or column().search() methods at all. If you wish to be able to throttle calls to those API methods use the utility method $.fn.dataTable.util.throttle().

Type

This option can be given in the following type(s):

Default

  • Value: null

When given as null DataTables will automatically assign a value that is suitable for the processing mode that the DataTable is operating in:

  • Instant - client-side processing
  • 400mS - server-side processing

Example

Set a 350mS throttle for searching:

$('#example').DataTable( {
  searchDelay: 350
} );

Related

The following options are directly related and may also be useful in your application development.