Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamrealfarhanbd/500f389c3dda50eb8a1b71d5972812dc to your computer and use it in GitHub Desktop.
Save iamrealfarhanbd/500f389c3dda50eb8a1b71d5972812dc to your computer and use it in GitHub Desktop.
Code snippet to modify the delay time for Ninja Tables filter functionality.
/**
* Adjust the delay time for Ninja Tables filter functionality.
*
* @param int $delayTime The default delay time in milliseconds.
* @param int $tableId The ID of the Ninja Table.
* @return int The modified delay time.
*/
add_filter('ninja_table_search_time_delay', function ($delayTime, $tableId) {
if ($tableId == 1) {
return 500; // 500ms for a particular table
}
return $delayTime; // default delay time (1000ms) for all tables except table id 1
}, 10, 2);
@iamrealfarhanbd
Copy link
Author

This code snippet checks if the table ID is 1, and if so, it sets the delay time to 500 milliseconds. For all other tables, the default delay time remains 1000 milliseconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment