@jimka/typescript-ui / component/table / TableExporter
Class: TableExporter
Defined in: src/typescript/lib/component/table/TableExporter.ts:30
Stateless helper that converts a column list and a record list into a CSV or JSON download.
Remarks
Used internally by Table.exportCSV and Table.exportJSON. Date, time, and datetime values are formatted with the same toLocale* options the cell renderers use, so exports match what the user sees.
Constructors
new TableExporter()
new TableExporter(): TableExporterReturns
Methods
exportCSV()
static exportCSV(
columns: Column[],
records: ModelRecord[],
columnConfigs: Map<string, ColumnConfig>,
options?: ExportOptions): voidDefined in: src/typescript/lib/component/table/TableExporter.ts:40
Converts columns + records to an RFC 4180 CSV string and triggers a download.
Parameters
columns
Column[]
The columns to include as fields in the CSV.
records
The records to serialize as rows.
columnConfigs
Map<string, ColumnConfig>
Per-field column config map (carries showSeconds for time/datetime).
options?
Optional export options.
Returns
void
exportJSON()
static exportJSON(
columns: Column[],
records: ModelRecord[],
columnConfigs: Map<string, ColumnConfig>,
options?: ExportOptions): voidDefined in: src/typescript/lib/component/table/TableExporter.ts:69
Converts columns + records to a pretty-printed JSON array of objects and triggers a download.
Parameters
columns
Column[]
The columns whose field names become the keys of each emitted object.
records
The records to serialize.
columnConfigs
Map<string, ColumnConfig>
Per-field column config map (carries showSeconds for time/datetime).
options?
Optional export options.
Returns
void