DataTables Data Processing Mode (AJAX or Preloaded)
AJAX ("server-side") processing calls the website every time there is a change in search, sorting, or paging. Preloaded ("client-side") processing pulls in all of the data during the initial load. This means that the View will take longer to load initially, but then any actions after that will be instantaneous (e.g. searching, sorting, paging, filtering, etc).
There are some considerations when choosing the DataTables Data Processing Mode.
Why preload data?
1. Speed
DataTables' performance relies on the website server’s response time. Slow server responses can lead to delays when loading and updating data. This may result in a slow experience for the user.
Preloading the data will result in near-instantaneous data navigation (making for a much better user experience). However, the more data you have to load increases the likelihood that the users' computer won't be able to handle it.
2. Ability to filter by Custom Content fields
Preloaded content makes it possible to filter by Custom Content fields, something that isn't possible when using AJAX (or any other GravityView layout).
3. Cacheable
If you use a caching plugin, want to preload data, and do not want the data to ever be stale, disable caching on pages that have the View embedded on them.
If you use a caching plugin on your website, the data rendered on the page may be cached. This is a bonus for speed, but it also means that the rendered data may be out-of-date, depending on the duration of your cache. For this reason, it's also a reason not to preload!
Reasons not to preload data
1. Your View holds a large number of entries
With client-side processing, all the entry data will be loaded onto the page at once. This can slow the initial rendering of the page, increasing the initial load time and potentially overwhelming the browser. The maximum recommended number of entries depends on the age of the computer.
In addition to loading all the entry data at once, all processing (sorting, filtering, paging) is also done by the browser, which can be resource-intensive for the user's device. All this to say that if your View holds a large number of entries, we recommend using AJAX processing.
2. You're using the "Auto-Update" feature
Enabling Auto-Update means that your View will refresh its data automatically on a schedule that you set (e.g., every minute). However, Auto-Update will not work when data is preloaded.
3. Not cached
If you require your data to be the latest values, use AJAX data processing mode. The data won't be cached. You can embed a View on a cached page and the data will be pulled into the table dynamically.