Exports - Jet\DataListing_Export
Each data export used in a data list must be represented by its own class, which must inherit from this abstract Jet\DataListing_Export.
For an example, see the sample application in the EventViewer.Admin, EventViewer.REST and EventViewer.Web modules.
Method Overview
Method | Meaning of |
---|---|
public setListing( DataListing $listing ) : void |
The list automatically sets the export reference to itself when the export is passed. This method is used for this purpose. |
public getListing( ) : DataListing |
Returns the instance of the data list to which the export belongs. |
public getKey( ) : string |
Returns a unique key identifying the export. It is recommended to implement as follows:
class Listing_Export_CSV extends DataListing_Export_CSV
And the export can then be handled as follows:
$listing->export( Listing_Export_CSV::KEY )->export();
|
public getTitle( ) : string |
Returns the generated and possibly already translated export header. |
public getIcon( ) : string |
Can return the name of the export icon. Optional. |
public export( array $column_keys=[] ) : void |
Executes itself from the columns specified by the $column_keys parameter, or from the currently displayed columns. It works as follows:
|
abstract protected formatData( array $export_header, array $data ) : void |
Transforms the data into the required format and sends the data to the output. Example of implementation - conversion to CSV:
protected function formatData( array $export_header, array $data ): void
|