Data Table

The data table function is used to render a feature rich table with ability and capability to do search on the data, pagination, export and save the data, column visibility and column sorting.

Structure

dataTable($title = "Table title", $dataquery, $sizeclass = "col-md-12", $allow_copy = 'Yes', $allow_csv = 'Yes', $allow_excel = 'Yes', $allow_pdf = 'Yes', $allow_print = 'Yes', $sortColumn = 0, $SortOrder = 'desc', $recordsPerPage = 50)

Parameters

The data table has a number of parameters that we shall take a look at below:

  • Title- This is the title of the table

  • Dataquery- This is the sql query that is passed in using sql() function for Appgini to render the chart data.

  • Size class - This is the bootstrap size class default is: col-md-12

  • Allow copy- This specifies if copy button will be shown, default is Yes

  • Allow CSV- This specifies if csv button will be displayed, default is Yes

  • Allow Excel- This specifies if excel export button will be shown, default is Yes

  • Allow PDF- This specifies if pdf button will be shown, default is Yes

  • Allow Print- This specifies if print button will be shown, default is Yes

  • Sort column- This is the column number to be sorted default is 0 for first column

  • Sord Order- This is the order to be used to sort the sort column , defailt is: desc

  • Records per page- This specifies how many pages to be shown per page, default is 50

Example usage

echo dataTable('Suppliers',sql("SELECT * FROM suppliers LIMIT 10",$eo));

From the above we have only provided title and query, the rest of the parameters we shall not pass and the default values will be applied since we do not wish to change them.

The output

Last updated