In the Wonderful Relations datatable configuration you can create datatable fields. Every field must be present in the underyling query. This concept is used to have an presentation layer. So data manipulation should be handlet in the query, presentation in the datatable settings.

Parameters:

  • Query Field
  • Title
  • Type
  • Visibility
  • Text Align
  • Sort Order
  • DataTable Order
  • DataTable Order Type
  • Renderfunction

Query Field:

You can only select fields present in the underlying query.

Title:

Title of the Datatable Column

Type:

Expected datatype. This information is used to render the data with the default render function for this type. See Render Functions.

Special Case: Subtable data is prepared on the server side, so we also have to generate html code on the server side, which is more limited than to do this with a render function in the frontend.

Visibility:

  • Visible – Show data in table
  • Hidden – Do not show data in table, but provide it
  • Collapse – Data is shown in the colapsed section

Text Align:

  • left
  • right
  • center

Sort Order:

Order of column

DataTable Order & Order Type:

As you can reorder the data by column and because of the server side paging approach, we have to think about, in which order the data should be presented. This is important, that the table could have the columns highlighted, and also for datatables, that no reloading of data happends. 

Example: a table with page size 25 and DataTable Order created_at, Order Type DESC. The server applies ORDER BY created_at DESC to the whole result set before slicing out the requested page — page 1 shows the 25 newest rows, page 2 the next 25, and so on. When the user clicks a column header, the new ordering replaces the configured one and the current page is re-fetched from the server with the new ORDER BY; no full reload of the table is needed, only the row request (get_datatable_entries) fires again.

Renderfunction:

If you what to present data in a different way then the default renderfunctions provide, you can insert here a custom renderfunction.