As described in the DataTables documentation, the client side sends specific format of query parameters to the server side.
When making a request to the server using server-side processing, DataTables
will send data as described in
Query in order
to let the server know what data is required.
Once DataTables has made a request for data, with the above parameters sent to
the server, it expects JSON data to be returned to it, with the parameters set
as described in
- class flask_datatables.typing.Column¶
- class flask_datatables.typing.ObjectData¶
Server-side processing return using objects.
Add the data contained in the object to the row
trnode as attributes. The object keys are used as the attribute keys and the values as the corresponding attribute values. This is performed using using the `jQuery`_
param()method. Please note that this option requires DataTables 1.10.5 or newer.
Add the data contained in the object to the row using the `jQuery`_
data()method to set the data, which can also then be used for later retrieval (for example on a click event).
- class flask_datatables.typing.Order¶
Column to which ordering should be applied. This is an index reference to the
columnsarray of information that is also submitted to the server.
- class flask_datatables.typing.Query¶
When making a request to the server using server-side processing, DataTables will send the following data in order to let the server know what data is required.
Draw counter. This is used by DataTables to ensure that the Ajax returns from server-side processing requests are drawn in sequence by DataTables (Ajax requests are asynchronous and thus can return out of sequence). This is used as part of the
drawreturn parameter (see below).
Number of records that the table can display in the current draw. It is expected that the number of records returned will be equal to this number, unless the server has fewer records to return. Note that this can be -1 to indicate that all records should be returned (although that negates any benefits of server-side processing!)
- class flask_datatables.typing.Response¶
Once DataTables has made a request for data, with the above parameters sent to the server, it expects JSON data to be returned to it, with the following parameters set.
The data to be displayed in the table. This is an array of data source objects, one for each row, which will be used by DataTables. Note that this parameter’s name can be changed using the
The draw counter that this object is a response to - from the
drawparameter sent as part of the data request. Note that it is strongly recommended for security reasons that you cast this parameter to an integer, rather than simply echoing back to the client what it sent in the
drawparameter, in order to prevent Cross Site Scripting (XSS) attacks.
If an error occurs during the running of the server-side processing script, you can inform the user of this error by passing back the error message to be displayed using this parameter. Do not include if there is no error.
Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned for this page of data).
- class flask_datatables.typing.Search¶
Trueif the global filter should be treated as a regular expression for advanced searching,
Falseotherwise. Note that normally server-side processing scripts will not perform regular expression searching for performance reasons on large data sets, but it is technically possible and at the discretion of your script.