Skip to main content

Data Export

Super Admin supports exporting grid data to CSV and Excel formats.

Built-in Exporters​

CSV Export (Default)​

use SuperAdmin\Admin\Grid\Exporters\CsvExporter;

$grid->exporter(new CsvExporter());

Excel Export​

use SuperAdmin\Admin\Grid\Exporters\ExcelExporter;

$grid->exporter(new ExcelExporter());

Disable Export​

$grid->disableExport();

Export Options​

The export button provides three options:

  • All - Export all records (ignoring pagination)
  • Current page - Export only the current page
  • Selected rows - Export only selected rows

Custom Exporter​

Create a custom exporter by implementing the ExporterInterface:

<?php

namespace App\Admin\Exporters;

use SuperAdmin\Admin\Grid\Exporters\ExporterInterface;

class PdfExporter implements ExporterInterface
{
public function export()
{
// Your export logic here
}
}

Use it:

$grid->exporter(new PdfExporter());