Search code examples
ajaxdatatablesdatatables-1.10jquery-datatables-editorphpgrid

DataTables Editor: possible to use AjAX calls for retrieving data?


I noticed that in all the examples provided by the website, all data is retrieved from the database at page load. However, in my case this would result in having to retrieve a significant amount of data, from which only part of it is being edited. I am no expert, but this would seem inefficient in terms of performance. I've also seen PhpGrid.org and they seem to use AJAX calls for each page.

  1. Would you agree, or could someone explain why the current method is in fact more efficient?
  2. Is there a way to only retrieve data for the page that is being viewed (i.e. via AJAX calls) ?

Can someone convince me? :-)


Solution

  • Please refer to DataTables manual page about data for more information. Below is an excerpt:

    DataTables has two different modes of processing data (ordering, searching, etc. of data):

    Client-side processing - the full data set is loaded up-front and data processing is done in the browser.

    Server-side processing - an Ajax request is made for every table redraw, with only the data required for each display returned. The data processing is performed on the server.

    Each has its own advantages and disadvantages, but the key indicator for which mode you should select is based on the number of rows in your table.

    You're referring to client-side processing mode which loads all data at once. However, in server-side processing mode only current page data is loaded which improves performance.