Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Here's a general guide: Use our server side export instead of DataTables' Button client export. In your report setup, uou can check if this is an export request (with $_GET, $_POST, or your request object). If it is, you pipe all data from your source to a datastore called "exportedData". Then in your export view page you use that datastore instead of the one that DataTables uses.
If you are exporting big table data (no chart) to excel, it's advisable to use BigSpreadsheetExportable instead of ExcelExportable as it's faster and uses much less memory.
Ok, here's an example code:
//MyReport.view.php
<form method="post">
<button type="submit" name="exportAllData" formaction="path/to/export.php">Export all data</button>
</form>
//export.php
include "MyReport.php";
$report = new MyReport();
$report
->run()
->exportToExcel(array(
"dataStores" => array(
"exportedDataStore" => array()
)
))
->toBrowser("SalesQuarters.xlsx");
//MyReport.php
function setup()
{
if (isset($_POST["exportAllData"])) {
$this->src("myDataSource")
->query("select * from MyTable")
->pipe($this->dataStore("exportedDataStore"));
}
...
Can you please provide some solution which can be integrated from the buttons?
'buttons' => [
[
'extend' => 'csv',
'className' => 'btn btn-default btn-icon',
'text' => '<i class="fi fi-rr-file"></i>'
],
[
'extend' => 'excel',
'className' => 'btn btn-default btn-icon',
'text' => '<i class="dci dci-file-excel"></i>'
],
[
'extend' => 'print',
'className' => 'btn btn-default btn-icon',
'text' => '<i class="fi fi-rr-print"></i>'
],
],
I have page similar to this but with server side enabled and had many records. https://www.koolreport.com/examples/reports/datagrid/plugins/
Probably just remap those button to call server side exporting instead of their default client side export, which would never be able to export huge amount of data client-side. You can try to search to "DataTables buttons run javascript function". Then in the js function call server side Export button click. Rgds,
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo